+static void print_pager(int items, int pagelen, char *search, char *sort)
+{
+ int i, ofs;
+ char *class = NULL;
+ html("<ul class='pager'>");
+ for (i = 0, ofs = 0; ofs < items; i++, ofs = i * pagelen) {
+ class = (ctx.qry.ofs == ofs) ? "current" : NULL;
+ html("<li>");
+ cgit_index_link(fmt("[%d]", i + 1), fmt("Page %d", i + 1),
+ class, search, sort, ofs);
+ html("</li>");
+ }
+ html("</ul>");
+}
+
+static int cmp(const char *s1, const char *s2)
+{
+ if (s1 && s2) {
+ if (ctx.cfg.case_sensitive_sort)
+ return strcmp(s1, s2);
+ else
+ return strcasecmp(s1, s2);
+ }
+ if (s1 && !s2)
+ return -1;
+ if (s2 && !s1)
+ return 1;
+ return 0;
+}
+
+static int sort_section(const void *a, const void *b)