fix #newpage issues

This commit is contained in:
mappu 2017-12-10 13:32:35 +13:00
parent add69c5c81
commit 559283566b
1 changed files with 5 additions and 0 deletions

View File

@ -74,6 +74,11 @@ func (this *ArchiveState) renderView(w http.ResponseWriter) {
lines := strings.Split(string(fc), "\n")
// Work around #newpage: if the last line is blank, skip
if len(lines) > 0 && len(lines[len(lines)-1]) == 0 {
lines = lines[:len(lines)-1]
}
this.highestPage = int(math.Ceil(float64(len(lines))/float64(this.svr.cfg.LinesPerPage))) - 1
if this.page == pageNotSet || this.page > this.highestPage {
this.page = this.highestPage