Sorry @dan753722 but I had trouble figuring out how this function works. Also, sometimes it didn't function correctly with all numbered buttons being hidden. If I could suggest a refactored version:
```Javascript
reorderPageButtons: function() { // Always have at most 7 buttons displayed (2 for nav, 5 for page numbers)
  this.numOfPageBtnEachSide = (this.resources.NUM_OF_PAGE_BUTTONS_SHOW - 1) / 2;
  this.$('.pagi').addClass(this.resources.HIDE_CLASS);
  var extraBelow = this.numOfPageBtnEachSide - (this.totalPages - this.pageNumber), // if we are close to the end, show more pages lower than this.pageNumber
  extraAbove = this.numOfPageBtnEachSide - (this.pageNumber - this.resources.DEFAULT_PAGE_NUM); // if we are close to the start, show more pages greater than this.pageNumber
  extraBelow = (extraBelow > 0) ? extraBelow : 0; // if you're at the last page (9) show extra pages below it (8,7,6,5)
  extraAbove = (extraAbove > 0) ? extraAbove : 0; // if at page 1 show not just 2, 3 but also 4 and 5

  for (var i = this.pageNumber - this.numOfPageBtnEachSide - extraBelow; i <= this.pageNumber + this.numOfPageBtnEachSide + extraAbove; i++) {
    this.$('.' + this.makePagiClassName(i)).removeClass(this.resources.HIDE_CLASS);
  }
}
```