]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: only display "next" links in logs if there is a next page
authorLea Wiemann <redacted>
Tue, 27 May 2008 23:25:42 +0000 (01:25 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:33 +0000 (00:07 -0400)
There was a bug in the implementation of the "next" links in
format_paging_nav (for log and shortlog), which caused the next links
to always be displayed, even if there is no next page.  This fixes it.

Signed-off-by: Lea Wiemann <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index d3950f53c13812ef0cd8a4bfdc7630ce33a87fff13b2980caa9f3080ea2c5d55..a97c2ecb2bede7e108cb4a94b0d71d9bb7f57a211bcc8af348c16b2348406c92 100755 (executable)
@@ -2757,7 +2757,7 @@ sub git_print_page_nav {
 }
 
 sub format_paging_nav {
-       my ($action, $hash, $head, $page, $nrevs) = @_;
+       my ($action, $hash, $head, $page, $has_next_link) = @_;
        my $paging_nav;
 
 
@@ -2775,7 +2775,7 @@ sub format_paging_nav {
                $paging_nav .= " &sdot; prev";
        }
 
-       if ($nrevs >= (100 * ($page+1)-1)) {
+       if ($has_next_link) {
                $paging_nav .= " &sdot; " .
                        $cgi->a({-href => href(-replay=>1, page=>$page+1),
                                 -accesskey => "n", -title => "Alt-n"}, "next");
@@ -4666,7 +4666,7 @@ sub git_log {
 
        my @commitlist = parse_commits($hash, 101, (100 * $page));
 
-       my $paging_nav = format_paging_nav('log', $hash, $head, $page, (100 * ($page+1)));
+       my $paging_nav = format_paging_nav('log', $hash, $head, $page, $#commitlist >= 100);
 
        git_header_html();
        git_print_page_nav('log','', $hash,undef,undef, $paging_nav);
@@ -5586,7 +5586,7 @@ sub git_shortlog {
 
        my @commitlist = parse_commits($hash, 101, (100 * $page));
 
-       my $paging_nav = format_paging_nav('shortlog', $hash, $head, $page, (100 * ($page+1)));
+       my $paging_nav = format_paging_nav('shortlog', $hash, $head, $page, $#commitlist >= 100);
        my $next_link = '';
        if ($#commitlist >= 100) {
                $next_link =
This page took 0.339442 seconds and 4 git commands to generate.