X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/3d1203e4c3f854ace76fc5c1400dbef514a62413..9e77997d64595a5bd35f7aa884759dfe3d609dde:/admin/commits.php
diff --git a/admin/commits.php b/admin/commits.php
index 932a556..7a97ad0 100644
--- a/admin/commits.php
+++ b/admin/commits.php
@@ -2,7 +2,12 @@
$pagesize = 20;
$gitcmd = "git log -n $pagesize --pretty='%at\t%an\t%s'";
+if ( $offset = intval(@$_GET['start']) ) {
+ $gitcmd .= " --skip=$offset";
+}
+
if ( $log = popen($gitcmd, 'r') ) {
+ $lines = 0;
print "
\n";
while ( $line = fgets($log) ) {
list ($atime, $author, $message) = explode("\t", $line, 3);
@@ -10,7 +15,21 @@ if ( $log = popen($gitcmd, 'r') ) {
printf('- %s %s ⢠%s
'."\n",
$message, $author, strftime('%F %H:%M', $atime)
);
+ $lines++;
}
print "
\n\n";
pclose($log);
+
+ $nav = [];
+ $nav[] = sprintf('Pagina %d', floor($offset / $pagesize) + 1);
+ if ($offset > 0) {
+ $nav[] = sprintf('%s', 0, 'laatste');
+ }
+ if ($offset > $pagesize) {
+ $nav[] = sprintf('%s', $offset - $pagesize, 'later');
+ }
+ if ($lines >= $pagesize) {
+ $nav[] = sprintf('%s', $offset + $pagesize, 'eerder');
+ }
+ printf("%s
\n\n", implode(' ⢠', $nav));
}