From 7377c30bfe23e577fc50b877f22ddaba8775c1a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Oct 2019 13:17:13 +0200 Subject: [PATCH] Fix limit --- htdocs/categories/class/categorie.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 9075e170137..f31e8f9b048 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -868,7 +868,15 @@ class Categorie extends CommonObject } } - if ($limit) $sql.= $this->db->plimit($limit + 1, $offset); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $this->db->plimit($limit + 1, $offset); + } $result = $this->db->query($sql); if ($result)