diff --git a/contrib/backends/srndv2/src/srnd/null_cache.go b/contrib/backends/srndv2/src/srnd/null_cache.go index 37eb04d..cf5aea9 100644 --- a/contrib/backends/srndv2/src/srnd/null_cache.go +++ b/contrib/backends/srndv2/src/srnd/null_cache.go @@ -95,8 +95,12 @@ func (self *nullHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { if strings.HasPrefix(path, "/b/") { // board handler parts := strings.Split(path[3:], "/") - page := 0 group := parts[0] + page := 0 + pages := self.database.GetGroupPageCount(group) + if self.invertPagination { + page = int(pages) - 1 + } if len(parts) > 1 && parts[1] != "" && parts[1] != "json" { var err error page, err = strconv.Atoi(parts[1]) @@ -116,8 +120,6 @@ func (self *nullHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { if banned { goto notfound } - - pages := self.database.GetGroupPageCount(group) if page >= int(pages) { goto notfound } diff --git a/contrib/backends/srndv2/src/srnd/templates_impl.go b/contrib/backends/srndv2/src/srnd/templates_impl.go index 179ddea..41a8aa9 100644 --- a/contrib/backends/srndv2/src/srnd/templates_impl.go +++ b/contrib/backends/srndv2/src/srnd/templates_impl.go @@ -283,17 +283,13 @@ func (self *templateEngine) genUkkoPaginated(prefix, frontend string, wr io.Writ } } obj := map[string]interface{}{"prefix": prefix, "threads": threads, "page": page} - if invertPagination { - obj["prev"] = map[string]interface{}{"no": page - 1} - } else if page > 0 { + if page > 0 { obj["prev"] = map[string]interface{}{"no": page - 1} } if invertPagination { obj["next"] = map[string]interface{}{"no": page + 1} - } else { - if page < 10 { - obj["next"] = map[string]interface{}{"no": page + 1} - } + } else if page < 10 { + obj["next"] = map[string]interface{}{"no": page + 1} } if json { self.renderJSON(wr, obj)