clampRowsPerPage function

int clampRowsPerPage(
  1. int expectedRows,
  2. int totalRows
)

Implementation

int clampRowsPerPage(int expectedRows, int totalRows) {
  if (totalRows == 0) {
    return 1;
  }

  if (totalRows <= expectedRows) {
    return totalRows;
  }

  return expectedRows;
}