@@ -95,26 +95,29 @@ public static function getInlineStyles()
9595 protected function generatePageBrowser ()
9696 {
9797 $ markup = '' ;
98- for ($ page = 1 ; $ page <= min ($ this ->totalPages , $ this ->currentPage , self ::PAGES_AFTER_START + 1 ); $ page ++) {
99- $ markup .= $ this ->createCell ($ page );
98+ $ pageMax = min ($ this ->totalPages , $ this ->currentPage , self ::PAGES_AFTER_START + 1 );
99+ $ page = $ pageMax + 1 ;
100+ for ($ i = 1 ; $ i <= $ pageMax ; $ i ++) {
101+ $ markup .= $ this ->createCell ($ i );
100102 }
101103
102104 if ($ page < $ this ->currentPage - self ::PAGES_BEFORE ) {
103105 $ markup .= $ this ->createEllipses ();
104106 $ page = $ this ->currentPage - self ::PAGES_BEFORE ;
105107 }
106108
107- for (; $ page <= min ($ this ->totalPages , $ this ->currentPage + self ::PAGES_AFTER ); $ page ++) {
108- $ markup .= $ this ->createCell ($ page );
109+ $ pageMax = min ($ this ->totalPages , $ this ->currentPage + self ::PAGES_AFTER );
110+ for ($ i = $ page ; $ i <= $ pageMax ; $ i ++) {
111+ $ markup .= $ this ->createCell ($ i );
109112 }
110113
111- if ($ page < $ this ->totalPages - self ::PAGES_BEFORE_END ) {
114+ if ($ pageMax < $ this ->totalPages - self ::PAGES_BEFORE_END ) {
112115 $ markup .= $ this ->createEllipses ();
113116 $ page = $ this ->totalPages - self ::PAGES_BEFORE_END ;
114117 }
115118
116- for (; $ page <= $ this ->totalPages ; $ page ++) {
117- $ markup .= $ this ->createCell ($ page );
119+ for ($ i = $ page; $ i <= $ this ->totalPages ; $ i ++) {
120+ $ markup .= $ this ->createCell ($ i );
118121 }
119122
120123 return $ markup ;
0 commit comments