Skip to content

Commit 1f684dc

Browse files
Lea Wiemanngitster
authored andcommitted
gitweb: only display "next" links in logs if there is a next page
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a17171b commit 1f684dc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

gitweb/gitweb.perl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2676,7 +2676,7 @@ sub git_print_page_nav {
26762676
}
26772677

26782678
sub format_paging_nav {
2679-
my ($action, $hash, $head, $page, $nrevs) = @_;
2679+
my ($action, $hash, $head, $page, $has_next_link) = @_;
26802680
my $paging_nav;
26812681

26822682

@@ -2694,7 +2694,7 @@ sub format_paging_nav {
26942694
$paging_nav .= " &sdot; prev";
26952695
}
26962696

2697-
if ($nrevs >= (100 * ($page+1)-1)) {
2697+
if ($has_next_link) {
26982698
$paging_nav .= " &sdot; " .
26992699
$cgi->a({-href => href(-replay=>1, page=>$page+1),
27002700
-accesskey => "n", -title => "Alt-n"}, "next");
@@ -4585,7 +4585,7 @@ sub git_log {
45854585

45864586
my @commitlist = parse_commits($hash, 101, (100 * $page));
45874587

4588-
my $paging_nav = format_paging_nav('log', $hash, $head, $page, (100 * ($page+1)));
4588+
my $paging_nav = format_paging_nav('log', $hash, $head, $page, $#commitlist >= 100);
45894589

45904590
git_header_html();
45914591
git_print_page_nav('log','', $hash,undef,undef, $paging_nav);
@@ -5505,7 +5505,7 @@ sub git_shortlog {
55055505

55065506
my @commitlist = parse_commits($hash, 101, (100 * $page));
55075507

5508-
my $paging_nav = format_paging_nav('shortlog', $hash, $head, $page, (100 * ($page+1)));
5508+
my $paging_nav = format_paging_nav('shortlog', $hash, $head, $page, $#commitlist >= 100);
55095509
my $next_link = '';
55105510
if ($#commitlist >= 100) {
55115511
$next_link =

0 commit comments

Comments
 (0)