| | 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]; |