code: private int getCurrentPageEndRow() {
  		TableDataModel model = getDataModel();
  		int rowsPerPage = getRowsPerPage();
  		int endRow = model.getRowCount() - 1;
  
  		if (getPaginationMode() != PaginationMode.NONE) {
  			if (model instanceof TreeTableDataModel) {
  				// For tree tables, pagination only occurs on first-level nodes (ie. those
  				// underneath the root node), however they might not be consecutively
  				// numbered. Therefore, the start and end row indices need to be adjusted.
  				TreeTableDataModel treeModel = (TreeTableDataModel) model;
  				TreeNode root = treeModel.getNodeAtLine(0).getRoot();
  
  				int endNode = Math.min(root.getChildCount() - 1,
  						(getCurrentPage() + 1) * rowsPerPage - 1);
  
  				endRow = ((TableTreeNode) root.getChildAt(endNode)).getRowIndex() - 1 // -1 as the root is not included in the table
  						+ ((TableTreeNode) root.getChildAt(endNode)).getNodeCount();
  			} else {
  				endRow = Math.min(model.getRowCount() - 1, (getCurrentPage() + 1) * rowsPerPage - 1);
  			}
  		}
  
  		return endRow;
  	}
docs: Retrieves the ending row index for the current page. Will always return the row count minus 1 for tables which
  are not paginated.
  
  @return the starting row index for the current page.