private void ensureTargetCaretPositionIsInFileBounds(long pagesAmount) {
    if (targetCaretPosition.pageNumber < 0) {
      targetCaretPosition.set(0, 0);
    }
    else if (targetCaretPosition.pageNumber >= pagesAmount) {
      targetCaretPosition.set(pagesAmount, 0);
    }
  }
private void ensureTargetCaretPositionIsInFileBounds(long pagesAmount)