Lea Wiemann <lewiemann@xxxxxxxxx> writes: > Lea Wiemann wrote: >> 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. > > Oh, one more thing I forgot to mention: I've tested this with a small > (single-page) log page and a long log page. In both cases the "next" > links get formatted correctly, and they stop linking to the next page > on the correct (= last) page. The only thing I haven't tested for is > off-by-one errors, but I'm reasonably sure that $#commitlist >= 100 is > right. I do not trust people who rely on "tests" to catch counting errors (although I am pretty bad at counting myself and often testsuite helps me catch my own bugs). Instead, let's follow the code to see if it is Ok. You call format_paging_nav() from two places, both after calling parse_commits() with $maxcount = 101. So @commitlist could have 101 elements (in which case you would need to have next page because you will show only 100 among them), or smaller than that (in which case you will fully show them). In other words, you would want to say 'next' iff (@commitlist > 100) is true. On the other hand, $#commitlist is the last index of @commitlist array, which is one smaller than the number of elements in that array. IOW, when it has 101 elements, it has $commitlist[0] thru $commitlist[100] and $#commitlist == 100. So the above condition is the same as ($#commitlist >= 100) So your counting looks correct to me. I wonder if it is easier to read to use the more modern @array notation than historic $#array notation (it looks very Perl 4 to me), but that is a separate issue. gitweb is littered with such anachronism ;-) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html