]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-repolist.c
Revert "filters/syntax-highlighting.sh: work around highlight --force bug"
[ps-cgit] / ui-repolist.c
index 4e2bdf4d0167455feebb5ab214523935da01cce1..46cbacfa7b520f6280302cdeffbd04609b5e1a18 100644 (file)
@@ -1,6 +1,7 @@
 /* ui-repolist.c: functions for generating the repolist page
  *
  * Copyright (C) 2006 Lars Hjemli
+ * Copyright (C) 2012 Jason A. Donenfeld <Jason@zx2c4.com>
  *
  * Licensed under GNU General Public License v2
  *   (see COPYING for full license text)
@@ -122,11 +123,14 @@ void print_header(int columns)
 
 void print_pager(int items, int pagelen, char *search, char *sort)
 {
-       int i;
+       int i, ofs;
+       char *class = NULL;
        html("<div class='pager'>");
-       for(i = 0; i * pagelen < items; i++)
-               cgit_index_link(fmt("[%d]", i+1), fmt("Page %d", i+1), NULL,
-                               search, sort, i * pagelen);
+       for(i = 0, ofs = 0; ofs < items; i++, ofs = i * pagelen) {
+               class = (ctx.qry.ofs == ofs) ? "current" : NULL;
+               cgit_index_link(fmt("[%d]", i+1), fmt("Page %d", i+1), class,
+                               search, sort, ofs);
+       }
        html("</div>");
 }