From 874733d530c7472f286bd1c69c0462f7bc7bf71b Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Sun, 5 Jan 2020 21:05:07 +0100 Subject: [PATCH 1/2] In search show the full result count instead of capped at 10. --- interface/web/dashboard/ajax_get_json.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/interface/web/dashboard/ajax_get_json.php b/interface/web/dashboard/ajax_get_json.php index 32fc8912e0..ddedf0c39c 100644 --- a/interface/web/dashboard/ajax_get_json.php +++ b/interface/web/dashboard/ajax_get_json.php @@ -194,8 +194,13 @@ function _search($module, $section, $additional_sql = '', $params = ''){ if(is_array($results) && !empty($results)){ $lng_file = '../'.$module.'/lib/lang/'.$_SESSION['s']['language'].'_'.$section.'.lng'; if(is_file($lng_file)) include $lng_file; + + // Get the real result count, without LIMIT. + $sql_real_rows = preg_replace(array('/\*/', "/ LIMIT.*$/"), array('COUNT(*) as c', ''), $sql); + $result_count = $app->db->queryOneRecord($sql_real_rows, $db_table); + $result_array['cheader'] = array('title' => $category_title, - 'total' => count($results), + 'total' => $result_count['c'], 'limit' => count($results) ); foreach($results as $result){ -- GitLab From 6f29d682ca8fab6bd3a53d486c63b74121854296 Mon Sep 17 00:00:00 2001 From: Helmo Date: Wed, 9 Dec 2020 09:16:26 +0100 Subject: [PATCH 2/2] Apply 1 suggestion(s) to 1 file(s) --- interface/web/dashboard/ajax_get_json.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/web/dashboard/ajax_get_json.php b/interface/web/dashboard/ajax_get_json.php index ddedf0c39c..76f284352b 100644 --- a/interface/web/dashboard/ajax_get_json.php +++ b/interface/web/dashboard/ajax_get_json.php @@ -196,7 +196,8 @@ function _search($module, $section, $additional_sql = '', $params = ''){ if(is_file($lng_file)) include $lng_file; // Get the real result count, without LIMIT. - $sql_real_rows = preg_replace(array('/\*/', "/ LIMIT.*$/"), array('COUNT(*) as c', ''), $sql); + $sql_real_rows = "SELECT COUNT(*) as `c` FROM ?? WHERE ".$where_clause.$authsql.$order_clause; + $result_count = $app->db->queryOneRecord($sql_real_rows, $db_table); $result_array['cheader'] = array('title' => $category_title, -- GitLab