| | $start = $this->hash !== '' ? $this->hash : $main['hash']; |
| | |
| | + $commits = []; |
| | + |
| | $this->git->history( |
| | $start, |
| | self::PER_PAGE, |
| | - function( $commit ) use ( &$count ) { |
| | - $this->renderCommitRow( $commit ); |
| | - |
| | - $count++; |
| | + function( $commit ) use ( &$commits ) { |
| | + $commits[] = $commit; |
| | } |
| | ); |
| | + |
| | + $count = count( $commits ); |
| | + $nav = $this->buildPaginationData( $main['hash'], $count ); |
| | + |
| | + $this->renderPaginationFromData( $nav ); |
| | + |
| | + foreach( $commits as $commit ) { |
| | + $this->renderCommitRow( $commit ); |
| | + } |
| | |
| | echo '</div>'; |
| | |
| | - $this->renderPagination( $main['hash'], $count ); |
| | + $this->renderPaginationFromData( $nav ); |
| | } |
| | }, $this->currentRepo ); |
 |
| | } |
| | |
| | - private function renderPagination( string $mainHash, int $count ) { |
| | - $nav = $this->buildPaginationData( $mainHash, $count ); |
| | + private function renderPaginationFromData( array $nav ) { |
| | $pages = $nav['pages']; |
| | $current = $nav['current']; |