Skip to content

Commit 797e137

Browse files
committed
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
2 parents 01e9717 + c17ddf8 commit 797e137

3 files changed

Lines changed: 21 additions & 4 deletions

File tree

phpstan-baseline.neon

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6252,6 +6252,12 @@ parameters:
62526252
count: 1
62536253
path: src/Display/Results.php
62546254

6255+
-
6256+
message: '#^Binary operation "\+" between mixed and int\|numeric\-string results in an error\.$#'
6257+
identifier: binaryOp.invalid
6258+
count: 1
6259+
path: src/Display/Results.php
6260+
62556261
-
62566262
message: '#^Binary operation "\+" between mixed and mixed results in an error\.$#'
62576263
identifier: binaryOp.invalid
@@ -6321,7 +6327,7 @@ parameters:
63216327
-
63226328
message: '#^Cannot access offset ''max_rows'' on mixed\.$#'
63236329
identifier: offsetAccess.nonOffsetAccessible
6324-
count: 18
6330+
count: 19
63256331
path: src/Display/Results.php
63266332

63276333
-

psalm-baseline.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4087,6 +4087,7 @@
40874087
<code><![CDATA[$_SESSION['tmpval']['max_rows']]]></code>
40884088
<code><![CDATA[$_SESSION['tmpval']['max_rows']]]></code>
40894089
<code><![CDATA[$_SESSION['tmpval']['max_rows']]]></code>
4090+
<code><![CDATA[$_SESSION['tmpval']['max_rows']]]></code>
40904091
<code><![CDATA[$_SESSION['tmpval']['pftext']]]></code>
40914092
<code><![CDATA[$_SESSION['tmpval']['pftext']]]></code>
40924093
<code><![CDATA[$_SESSION['tmpval']['pftext']]]></code>

src/Display/Results.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)