See the report Pagination on stackexchange.com search is broken

The pagination in the global search is broken. It only shows 15 results even when the page size is set to something different. Moreover, it loses the page size. Yet, the page count at the bottom seems to use a different page size than 15, so with many results, you would not see the last page(s) unless you navigate to them manually.


The page size should be hard set in the query parameters in the URL. That forces the pagination to work correctly.


If there is no page size in the URL, you are redirected to the same page but with the page size set. This will be set to 15 as that is what the default is. This works on going to the stackexchange.com/search page or visiting any search query.

The page navigation buttons will also now "remember" the correct page size (rather than losing it).


Direct install (GitHub)

See the code on GitHub


// ==UserScript==
// @name            Stack Exchange - fix network search pagination
// @namespace       https://github.com/PurpleMagick/
// @description     Network search pagination is broken and does not count pages correctly. This is a fix
// @author          VLAZ
// @version         1.0.0
// @match           https://stackexchange.com/search*
// @grant           none
// ==/UserScript==

let __webpack_exports__ = {};

// CONCATENATED MODULE: ./src/paginationParametersHelpers.ts
function retrievePagesize() {
    const searchParams = new URLSearchParams(window.location.search);
    return Number(searchParams.get("pagesize") ?? 15);
function createCorrecURL(href, pagesize) {
    const url = new URL(href);
    url.searchParams.set("pagesize", String(pagesize));
    return url;

// CONCATENATED MODULE: ./src/index.ts

function main() {
    const perPage = retrievePagesize();
    const searchParams = new URLSearchParams(window.location.search);
    if (searchParams.has("pagesize") === false) {
        window.location.href = createCorrecURL(window.location.href, perPage).href;
    document.querySelectorAll(".pager a")
        .forEach(el => {
            el.href = createCorrecURL(el.href, perPage).href;


You must log in to answer this question.

Browse other questions tagged .