Javascript pager logic
Assuming ES6 is available (you tagged ES6, you have let and const, etc.), this can be simplified.

First, you can compute ahead the number of pages you want to include. You don't need to loop through to check. In this case, your loop depends on who is lesser between MAX_PAGES_IN_PAGER and totPages. You can use Math.min.

const limit = Math.min(totPages, MAX_PAGES_IN_PAGER);


Next, instead of loops and push, you can use array methods. Let's start off by taking out the loop. To loop n times with arrays, you can create a filled array with n dummy items. This is possible with Array(n).fill(0). Then, instead of push, we use map. We turn the n dummy values into values we need.

return Array(limit).fill(0).map(_ =&gt; ({
  page: ...,
  href: ...,
  type: ...
}));


In other news, use template strings to construct strings instead of concatenating. Note that template strings use backticks instead of quotes.

pageUri.replace(`list-${page}`, `list-${pageNumber}`)


Ternaries are hard to read. However, there's a way to keep them readable. What you are doing is right, putting further conditions at the false end of the ternary. They can be written in a cascading manner for readability.

"type": pageNumber == page ? "current"
       : pageNumber &gt; page ? "next" 
                           : "prev"


Lastly, name your variables properly. totPages is confusing because "tot" doesn't tell me what it is. pager is confusing because it sounds like an object with methods, when it's just an array of objects representing pages.

Also, quotes on object keys are optional unless you are using key names with invalid characters.

In the end:

function createPageList(pageUri, page, totalPages) {

  const limit = Math.min(totalPages, 6);

  return Array(limit).fill(0).map((fill, index) =&gt; {

    const pageNumber = (page &lt; 3 ? 1 : page - 3) + index ;

    return {
      page: pageNumber,
      href: pageUri.replace(`list-${page}`, `list-${pageNumber}`)
      type: pageNumber == page ? "current"
           : pageNumber &gt; page ? "next" 
                               : "prev"
    };
  });
}