@@ -73,7 +73,7 @@ protected function getSmallSlider()
7373 */
7474 protected function getUrlSlider ($ onEachSide )
7575 {
76- $ window = $ onEachSide * 2 ;
76+ $ window = $ onEachSide + 4 ;
7777
7878 if (! $ this ->hasPages ()) {
7979 return ['first ' => null , 'slider ' => null , 'last ' => null ];
@@ -83,14 +83,14 @@ protected function getUrlSlider($onEachSide)
8383 // just render the beginning of the page range, followed by the last 2 of the
8484 // links in this list, since we will not have room to create a full slider.
8585 if ($ this ->currentPage () <= $ window ) {
86- return $ this ->getSliderTooCloseToBeginning ($ window );
86+ return $ this ->getSliderTooCloseToBeginning ($ window, $ onEachSide );
8787 }
8888
8989 // If the current page is close to the ending of the page range we will just get
9090 // this first couple pages, followed by a larger window of these ending pages
9191 // since we're too close to the end of the list to create a full on slider.
9292 elseif ($ this ->currentPage () > ($ this ->lastPage () - $ window )) {
93- return $ this ->getSliderTooCloseToEnding ($ window );
93+ return $ this ->getSliderTooCloseToEnding ($ window, $ onEachSide );
9494 }
9595
9696 // 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)
103103 * Get the slider of URLs when too close to beginning of window.
104104 *
105105 * @param int $window
106+ * @param int $onEachSide
106107 * @return array
107108 */
108- protected function getSliderTooCloseToBeginning ($ window )
109+ protected function getSliderTooCloseToBeginning ($ window, $ onEachSide )
109110 {
110111 return [
111- 'first ' => $ this ->paginator ->getUrlRange (1 , $ window + 2 ),
112+ 'first ' => $ this ->paginator ->getUrlRange (1 , $ window + $ onEachSide ),
112113 'slider ' => null ,
113114 'last ' => $ this ->getFinish (),
114115 ];
@@ -118,12 +119,13 @@ protected function getSliderTooCloseToBeginning($window)
118119 * Get the slider of URLs when too close to ending of window.
119120 *
120121 * @param int $window
122+ * @param int $onEachSide
121123 * @return array
122124 */
123- protected function getSliderTooCloseToEnding ($ window )
125+ protected function getSliderTooCloseToEnding ($ window, $ onEachSide )
124126 {
125127 $ last = $ this ->paginator ->getUrlRange (
126- $ this ->lastPage () - ($ window + 2 ),
128+ $ this ->lastPage () - ($ window + ( $ onEachSide - 1 ) ),
127129 $ this ->lastPage ()
128130 );
129131
0 commit comments