Refactor: calculate numOfPageBtnEachSide once only