From 559283566bcdab8ddda91bd1169b4ac18dfcb347 Mon Sep 17 00:00:00 2001 From: mappu Date: Sun, 10 Dec 2017 13:32:35 +1300 Subject: [PATCH] fix #newpage issues --- ArchiveState.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ArchiveState.go b/ArchiveState.go index 37e244f..bfa02df 100644 --- a/ArchiveState.go +++ b/ArchiveState.go @@ -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