code: public void setCurrentPageIndex(int currentPageIndex, boolean skipCheck){
          if( currentPageIndex < 1){
              throw new IndexOutOfBoundsException("currentPageIndex cannot be < 1");
          }
  
          if(!skipCheck){
              if(currentPageIndex >  pageCount()){
                  throw new IndexOutOfBoundsException("currentPageIndex it outside of record set boundaries. ");
              }
          }
          this.currentPageIndex = currentPageIndex;
      }
docs: Sets an index of a current page. This method will make a quick count query to check that
  the index you are setting is within the boundaries.
  
  @param currentPageIndex index of a current page.
  @param skipCheck <code>true</code> to skip the upper boundary check (will not make a call to DB).