From 0c5f57d5ba8497588ad27f8d55559dae1f2aeb79 Mon Sep 17 00:00:00 2001 From: Jean-Marc Pigeon Date: Mon, 24 Nov 2025 09:56:02 -0500 Subject: [PATCH] Working on display record management --- www/gessql.php | 9 +++++---- www/lvlusr.php | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/www/gessql.php b/www/gessql.php index ca52def..cf60f6a 100644 --- a/www/gessql.php +++ b/www/gessql.php @@ -97,7 +97,7 @@ class probe { /** * Count total number of items matching the current WHERE conditions */ - public function count(): int + public function getnumrec(): int { $sql = "SELECT COUNT(*) AS cnt FROM {$this->table}"; @@ -121,8 +121,9 @@ class probe { public function goNext(): int { if ($this->limit !== null) { - $this->offset += $this->limit; - } + $last=max($this->getnumrec(),$this->limit); + $this->offset = min($last-$this->limit,$this->offset+$this->limit); + } return $this->offset; } @@ -155,7 +156,7 @@ class probe { public function goLast(): int { if ($this->limit !== null) { - $total = $this->count(); + $total = $this->getnumrec(); $this->offset = max(0, $total - $this->limit); } return $this->offset; diff --git a/www/lvlusr.php b/www/lvlusr.php index 230b58e..9ef1cb6 100644 --- a/www/lvlusr.php +++ b/www/lvlusr.php @@ -98,7 +98,7 @@ if (isset($_POST['username'])) { $username=trim(($_POST['username'])); $rqst->where("email","like","%$username%"); } -$numrec=$rqst->count(); +$numrec=$rqst->getnumrec(); if (isset($_POST['scanner'])) { $scanner=$_POST['scanner']; switch ($scanner) { -- 2.47.3