mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 22:57:14 +02:00
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
This commit is contained in:
@@ -3530,17 +3530,17 @@ class e_tree_model extends e_front_model
|
|||||||
$db_query = $this->getParam('db_query');
|
$db_query = $this->getParam('db_query');
|
||||||
$db_query = preg_replace_callback("/LIMIT ([\d]+)[ ]*(?:,|OFFSET){0,1}[ ]*([\d]*)/i", function($matches)
|
$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
|
// Offset and count
|
||||||
if (isset($matches[2]))
|
else
|
||||||
{
|
{
|
||||||
$this->setParam('db_limit_offset', $matches[1]);
|
$this->setParam('db_limit_offset', $matches[1]);
|
||||||
$this->setParam('db_limit_count', $matches[2]);
|
$this->setParam('db_limit_count', $matches[2]);
|
||||||
}
|
}
|
||||||
// Count only
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->setParam('db_limit_count', $matches[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}, $db_query);
|
}, $db_query);
|
||||||
|
Reference in New Issue
Block a user