code: private static long getNextPageOffset(final int offset, final int limit, final long total) {
          return hasFullNextPage(offset, limit, total) ? getNextFullPageOffset(offset, limit) : getLastPageOffset(total, limit);
      }
docs: Gets the next page offset.
  
  @param offset    the current offset.
  @param limit     the limit.
  @param total     the total.
  @return the next page offset.