aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--man/blogc-pagination.7.ronn10
-rw-r--r--src/blogc/loader.c4
2 files changed, 8 insertions, 6 deletions
diff --git a/man/blogc-pagination.7.ronn b/man/blogc-pagination.7.ronn
index 80bdb16..4b3b4b6 100644
--- a/man/blogc-pagination.7.ronn
+++ b/man/blogc-pagination.7.ronn
@@ -12,14 +12,16 @@ blogc(1) in the command line, no sorting is done.
blogc(1) accepts some variables as `-D` options, that are used to filter the
files passed as arguments to it:
- * `FILTER_PER_PAGE`:
- Integer, limits the maximum number of files to be listed.
-
* `FILTER_PAGE`:
Integer, current page. If calling blogc(1) with 10 files,
- `FILTER_PER_PAGE`=4 and `FILTER_PAGE`=3, it will return just the 2 last
+ `FILTER_PER_PAGE=4` and `FILTER_PAGE=3`, it will return just the 2 last
files, skipping the first 2 pages with 4 files each one.
+ * `FILTER_PER_PAGE`:
+ Integer, limits the maximum number of files to be listed. If negative or
+ `0`, no posts are included. Have no effect if `FILTER_PAGE` is not
+ defined.
+
* `FILTER_TAG`:
String, if defined, blogc(1) will only list files that declare a `TAGS`
variable, as a space-separated list of tags (tags can't have spaces,
diff --git a/src/blogc/loader.c b/src/blogc/loader.c
index 881661b..c54b285 100644
--- a/src/blogc/loader.c
+++ b/src/blogc/loader.c
@@ -138,8 +138,8 @@ blogc_source_parse_from_files(bc_trie_t *conf, bc_slist_t *l, bc_error_t **err)
if (*ptr != '\0' && *endptr != '\0')
fprintf(stderr, "warning: invalid value for 'FILTER_PER_PAGE' variable: "
"%s. using %ld instead\n", ptr, per_page);
- if (per_page <= 0)
- per_page = 10;
+ if (per_page < 0)
+ per_page = 0;
// poor man's pagination
unsigned int start = (page - 1) * per_page;