summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Save <savetheinternet@tinyboard.org>2012-04-13 20:57:59 +1000
committerMichael Save <savetheinternet@tinyboard.org>2012-04-13 20:57:59 +1000
commitd1876a0dd66422570409787bae40aad371011b89 (patch)
treea37404e89ea82efe7363ff1d29b4bd864845b81e
parente92ee2b4879d110f4076c17c0033267dfbbc9197 (diff)
paginate moderation log
-rw-r--r--inc/mod/pages.php6
-rw-r--r--mod.php2
-rw-r--r--templates/mod/log.html6
3 files changed, 12 insertions, 2 deletions
diff --git a/inc/mod/pages.php b/inc/mod/pages.php
index 73015cf9..942cfd50 100644
--- a/inc/mod/pages.php
+++ b/inc/mod/pages.php
@@ -79,7 +79,11 @@ function mod_log($page_no = 1) {
$query->execute() or error(db_error($query));
$logs = $query->fetchAll(PDO::FETCH_ASSOC);
- mod_page('Moderation log', 'mod/log.html', array('logs' => $logs));
+ $query = prepare("SELECT COUNT(*) AS `count` FROM `modlogs`");
+ $query->execute() or error(db_error($query));
+ $count = $query->fetchColumn(0);
+
+ mod_page('Moderation log', 'mod/log.html', array('logs' => $logs, 'count' => $count));
}
function mod_view_board($boardName, $page_no = 1) {
diff --git a/mod.php b/mod.php
index c89c2f01..3aba6fe4 100644
--- a/mod.php
+++ b/mod.php
@@ -24,7 +24,7 @@ $pages = array(
'!^$!' => ':?/', // redirect to dashboard
'!^/$!' => 'dashboard', // dashboard
'!^/log$!' => 'log', // modlog
- '!^/log/(\d+)/$!' => 'log', // modlog
+ '!^/log/(\d+)$!' => 'log', // modlog
'!^/confirm/(.+)$!' => 'confirm', // confirm action (if javascript didn't work)
diff --git a/templates/mod/log.html b/templates/mod/log.html
index 4f2beb40..fe1c5c1f 100644
--- a/templates/mod/log.html
+++ b/templates/mod/log.html
@@ -31,3 +31,9 @@
{% endfor %}
</table>
+<p class="unimportant" style="text-align:center;word-wrap:break-word">
+ {% for i in range(0, count / config.mod.modlog_page) %}
+ <a href="?/log/{{ i + 1 }}">[{{ i + 1 }}]</a>
+ {% endfor %}
+</p>
+