From fd1616d7e7e533fc706026df77778e68559dd1c2 Mon Sep 17 00:00:00 2001 From: Emil Zhai Date: Mon, 5 Dec 2022 07:41:41 +0000 Subject: [PATCH] fix: pagination total should always larger than 0 --- Access_Logs.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Access_Logs.php b/Access_Logs.php index 7020d8b..91ef6c9 100644 --- a/Access_Logs.php +++ b/Access_Logs.php @@ -93,7 +93,7 @@ class Access_Logs { $resp['pagination'] = [ 'size' => $pageSize, 'current' => $pageNum, - 'total' => floor($resp['count'] / $pageSize), + 'total' => max(floor($resp['count'] / $pageSize), 1), ]; $resp['logs'] = $this->db->fetchAll($dataQuery); foreach ($resp['logs'] as &$row) { @@ -167,7 +167,7 @@ class Access_Logs { $resp['count'] = $this->db->fetchAll($counterQuery)[0]['count']; // delete more than one page requires 2nd time confirmation - if ($resp['count'] <= $this->config->pageSize || $force) { + if ($resp['count'] <= $this->config->pageSize || $force === 'force') { $this->db->query($operatorQuery); } else { $resp['requireForce'] = true;