@@ -73,7 +73,7 @@ protected function getSmallSlider()
73
73
*/
74
74
protected function getUrlSlider ($ onEachSide )
75
75
{
76
- $ window = $ onEachSide * 2 ;
76
+ $ window = $ onEachSide + 4 ;
77
77
78
78
if (! $ this ->hasPages ()) {
79
79
return ['first ' => null , 'slider ' => null , 'last ' => null ];
@@ -83,14 +83,14 @@ protected function getUrlSlider($onEachSide)
83
83
// just render the beginning of the page range, followed by the last 2 of the
84
84
// links in this list, since we will not have room to create a full slider.
85
85
if ($ this ->currentPage () <= $ window ) {
86
- return $ this ->getSliderTooCloseToBeginning ($ window );
86
+ return $ this ->getSliderTooCloseToBeginning ($ window, $ onEachSide );
87
87
}
88
88
89
89
// If the current page is close to the ending of the page range we will just get
90
90
// this first couple pages, followed by a larger window of these ending pages
91
91
// since we're too close to the end of the list to create a full on slider.
92
92
elseif ($ this ->currentPage () > ($ this ->lastPage () - $ window )) {
93
- return $ this ->getSliderTooCloseToEnding ($ window );
93
+ return $ this ->getSliderTooCloseToEnding ($ window, $ onEachSide );
94
94
}
95
95
96
96
// If we have enough room on both sides of the current page to build a slider we
@@ -103,12 +103,13 @@ protected function getUrlSlider($onEachSide)
103
103
* Get the slider of URLs when too close to beginning of window.
104
104
*
105
105
* @param int $window
106
+ * @param int $onEachSide
106
107
* @return array
107
108
*/
108
- protected function getSliderTooCloseToBeginning ($ window )
109
+ protected function getSliderTooCloseToBeginning ($ window, $ onEachSide )
109
110
{
110
111
return [
111
- 'first ' => $ this ->paginator ->getUrlRange (1 , $ window + 2 ),
112
+ 'first ' => $ this ->paginator ->getUrlRange (1 , $ window + $ onEachSide ),
112
113
'slider ' => null ,
113
114
'last ' => $ this ->getFinish (),
114
115
];
@@ -118,12 +119,13 @@ protected function getSliderTooCloseToBeginning($window)
118
119
* Get the slider of URLs when too close to ending of window.
119
120
*
120
121
* @param int $window
122
+ * @param int $onEachSide
121
123
* @return array
122
124
*/
123
- protected function getSliderTooCloseToEnding ($ window )
125
+ protected function getSliderTooCloseToEnding ($ window, $ onEachSide )
124
126
{
125
127
$ last = $ this ->paginator ->getUrlRange (
126
- $ this ->lastPage () - ($ window + 2 ),
128
+ $ this ->lastPage () - ($ window + ( $ onEachSide - 1 ) ),
127
129
$ this ->lastPage ()
128
130
);
129
131
0 commit comments