Make the number of pagination links configurable (see #4601)