@@ -616,8 +616,9 @@ private function getTableNavigation(
616616
617617 $ isLastPage = $ this ->unlimNumRows !== -1 && $ this ->unlimNumRows !== false
618618 && ($ isShowingAll
619- || (int ) $ _SESSION ['tmpval ' ]['pos ' ] + (int ) $ _SESSION ['tmpval ' ]['max_rows ' ]
620- >= $ this ->unlimNumRows
619+ || ($ this ->isExactCount ()
620+ && (int ) $ _SESSION ['tmpval ' ]['pos ' ] + (int ) $ _SESSION ['tmpval ' ]['max_rows ' ]
621+ >= $ this ->unlimNumRows )
621622 || $ this ->numRows < $ _SESSION ['tmpval ' ]['max_rows ' ]);
622623
623624 $ onsubmit = ' onsubmit="return '
@@ -663,6 +664,15 @@ private function getTableNavigation(
663664 ];
664665 }
665666
667+ private function isExactCount (): bool
668+ {
669+ // If we have the full page of rows, we don't know
670+ // if there are more unless unlimNumRows is smaller than MaxExactCount
671+ return $ this ->unlimNumRows < $ this ->config ->settings ['MaxExactCount ' ]
672+ || $ _SESSION ['tmpval ' ]['max_rows ' ] === self ::ALL_ROWS
673+ || $ this ->numRows < $ _SESSION ['tmpval ' ]['max_rows ' ];
674+ }
675+
666676 /**
667677 * Get the headers of the results table, for all of the columns
668678 *
@@ -3383,7 +3393,7 @@ private function setMessageInformation(
33833393 }
33843394 } elseif ($ _SESSION ['tmpval ' ]['max_rows ' ] === self ::ALL_ROWS || $ posNext > $ total ) {
33853395 $ firstShownRec = $ _SESSION ['tmpval ' ]['pos ' ];
3386- $ lastShownRec = $ total - 1 ;
3396+ $ lastShownRec = $ firstShownRec + $ this -> numRows - 1 ;
33873397 } else {
33883398 $ firstShownRec = $ _SESSION ['tmpval ' ]['pos ' ];
33893399 $ lastShownRec = $ posNext - 1 ;
0 commit comments