src/pagination.js
function pageRange(selected, numPages, num) {
  let selectedPos = Math.ceil(num / 2);
  let start = (selected < selectedPos) ? 1
    : selected - selectedPos + 1;
  let len = (numPages < start + num - 1) ? numPages - start + 1
    : num;

  return Array
    .apply(null, Array(len))
    .map((u, i) => start + i);
}
function pageRange(selected, numPages, num) {
  let selectedPos = Math.ceil(num / 2);
  let start = (selected < selectedPos) ? 1
    : selected - selectedPos + 1;
  let len = (numPages < start + num - 1) ? numPages - start + 1
    : num;

  return Array
    .apply(null, Array(len))
    .map((u, i) => start + i);
}
Returns an array with the range of pages to be displayed according to the params passed
@param {Number} selected The selected page number
@param {Number} numPages The total number of pages
@param {Number} num      The number of pages to display
@return {Array<Number>}