Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git
pages/CommitsPage.php
public function render() {
$this->renderLayout( function() {
- $main = $this->git->getMainBranch();
+ $main = $this->git->getMainBranch();
+ $start = '';
+ $count = 0;
if( !$main ) {
$start = $this->hash !== '' ? $this->hash : $main['hash'];
- $count = 0;
$this->git->history(
$start,
self::PER_PAGE,
function( $commit ) use ( &$count ) {
$this->renderCommitRow( $commit );
+
$count++;
}
$hasNext = $nav['hasNext'];
$hasPrev = $current > 1;
+ $prevSha = '';
+ $prevUrl = '';
+ $nextSha = '';
+ $nextUrl = '';
if( $hasPrev || $hasNext ) {
private function renderPageNumbers( array $pages, int $current ) {
$total = count( $pages );
+ $start = $current - 4;
$actual = 1;
- $start = 1;
- $end = $total;
+ $end = 0;
+ $sha = '';
+ $url = '';
- if( $total > 10 ) {
- if( $current >= 5 ) {
- $start = $current;
- $end = $current + 10;
- } else {
- $start = 1;
- $end = 10;
- }
+ if( $start < 1 ) {
+ $start = 1;
}
+
+ $end = $start + 9;
if( $end > $total ) {
- $end = $total;
+ $end = $total;
+ $start = $end - 9;
+
+ if( $start < 1 ) {
+ $start = 1;
+ }
}
while( $actual <= $total ) {
if( $actual >= $start && $actual <= $end ) {
if( $actual === $current ) {
- echo '<span class="page-badge">(' . $actual . ')</span>';
+ echo '<span class="page-badge">' . $actual . '</span>';
} else {
$sha = $pages[$actual - 1];

Updates pagination

Author Dave Jarvis <email>
Date 2026-02-20 18:37:44 GMT-0800
Commit ea3253abbda7fb1b16f76088be333a8fe76c9c56
Parent eb6df67
Delta 23 lines added, 14 lines removed, 9-line increase