From 6926a6f9128e608e2851437a85ecd64a226ab1b1 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Tue, 20 Sep 2022 17:19:11 +0800 Subject: [PATCH] fix: pagination count table --- web/app/controllers/groups.php | 3 ++- web/app/controllers/problem_lists.php | 3 ++- web/app/models/Paginator.php | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/web/app/controllers/groups.php b/web/app/controllers/groups.php index c674871..067e4dc 100644 --- a/web/app/controllers/groups.php +++ b/web/app/controllers/groups.php @@ -78,7 +78,8 @@ EOD; $new_group_form->printHTML(); } }, - 'head_pagination' => true + 'head_pagination' => true, + 'pagination_table' => "`groups`" ) ); ?> diff --git a/web/app/controllers/problem_lists.php b/web/app/controllers/problem_lists.php index e5140d2..3fef911 100644 --- a/web/app/controllers/problem_lists.php +++ b/web/app/controllers/problem_lists.php @@ -99,7 +99,8 @@ EOD; 'print_after_table' => function() { global $myUser; }, - 'head_pagination' => true + 'head_pagination' => true, + 'pagination_table' => 'lists' ) ); ?> diff --git a/web/app/models/Paginator.php b/web/app/models/Paginator.php index b3566cf..4578071 100644 --- a/web/app/models/Paginator.php +++ b/web/app/models/Paginator.php @@ -16,7 +16,10 @@ class Paginator { $this->cur_start = 0; $this->table = $config['data']; } elseif (!isset($config['echo_full'])) { - $this->n_rows = DB::selectCount("select count(*) from {$config['table_name']} where {$config['cond']}"); + if (!isset($config['pagination_table'])) { + $config['pagination_table'] = $config['table']; + } + $this->n_rows = DB::selectCount("select count(*) from {$config['pagination_table']} where {$config['cond']}"); $this->page_len = isset($config['page_len']) ? $config['page_len'] : 10;