mirror of
https://github.com/vrana/adminer.git
synced 2025-08-11 00:54:08 +02:00
Respect grouping in computing last page
This commit is contained in:
@@ -237,7 +237,11 @@ if (!$columns) {
|
|||||||
|
|
||||||
$page = $_GET["page"];
|
$page = $_GET["page"];
|
||||||
if ($page == "last") {
|
if ($page == "last") {
|
||||||
$found_rows = $connection->result("SELECT COUNT(*) FROM " . table($TABLE) . ($where ? " WHERE " . implode(" AND ", $where) : ""));
|
$query = " FROM " . table($TABLE) . ($where ? " WHERE " . implode(" AND ", $where) : "");
|
||||||
|
$found_rows = $connection->result($is_group && ($jush == "sql" || count($group) == 1)
|
||||||
|
? "SELECT COUNT(DISTINCT " . implode(", ", $group) . ")$query"
|
||||||
|
: "SELECT COUNT(*)" . ($is_group ? " FROM (SELECT 1$query$group_by) x" : $query)
|
||||||
|
);
|
||||||
$page = floor(max(0, $found_rows - 1) / $limit);
|
$page = floor(max(0, $found_rows - 1) / $limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user