From 0bbaaf4c6c01bc5a1642402f63fa7e046e614044 Mon Sep 17 00:00:00 2001 From: Deltik Date: Thu, 15 Feb 2018 13:59:13 -0600 Subject: [PATCH] Loose false check for e_tree_model sim. pagination e_tree_model::prepareSimulatedPagination() did not correctly handle the count-only condition because of an incorrectly written emptiness check. Fixes: #3034 --- e107_handlers/model_class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/e107_handlers/model_class.php b/e107_handlers/model_class.php index 3fdabcd2b..0e58b7a87 100755 --- a/e107_handlers/model_class.php +++ b/e107_handlers/model_class.php @@ -3530,17 +3530,17 @@ class e_tree_model extends e_front_model $db_query = $this->getParam('db_query'); $db_query = preg_replace_callback("/LIMIT ([\d]+)[ ]*(?:,|OFFSET){0,1}[ ]*([\d]*)/i", function($matches) { + // Count only + if (empty($matches[2])) + { + $this->setParam('db_limit_count', $matches[1]); + } // Offset and count - if (isset($matches[2])) + else { $this->setParam('db_limit_offset', $matches[1]); $this->setParam('db_limit_count', $matches[2]); } - // Count only - else - { - $this->setParam('db_limit_count', $matches[1]); - } return ""; }, $db_query);