<commit_before>import {ObjectType, Field, Root, Int} from "type-graphql"

export interface PageParams<T extends object> {
  limit: number

  offset: number

  page: number

  count: number

  rows: T[]
}

@ObjectType({isAbstract: true})
export abstract class Page<T extends object> {
  /**
   * Returns the number of the total rows in the list
   */
  @Field(() => Int)
  readonly count!: number

  /**
   * Returns per-page entities limit
   */
  @Field(() => Int)
  readonly limit!: number

  @Field(() => Int)
  readonly offset!: number

  /**
   * Returns the number of the current page
   */
  @Field(() => Int)
  current(@Root() {page = 1}: PageParams<T>): number {
    return page
  }

  /**
   * Indicates whether the list has next page or not
   */
  @Field(() => Boolean)
  hasNext(@Root() {limit, page, count}: PageParams<T>): boolean {
    if (limit != null && page != null && count != null) {
      return count - limit * page > 0
    }

    return false
  }

  /**
   * Returns the number of the past page
   */
  @Field(() => Int)
  last(@Root() {limit, page, count}: PageParams<T>): number {
    if (limit != null && page != null && count != null) {
      return Math.ceil(count / (limit * page))
    }

    return 1
  }<commit_msg>Small fix<commit_after>import {ObjectType, Field, Root, Int} from "type-graphql"

export interface PageParams<T extends object> {
  limit: number

  offset: number

  page: number

  count: number

  rows: T[]
}

@ObjectType({isAbstract: true})
export abstract class Page<T extends object> {
  /**
   * Returns the number of the total rows in the list
   */
  @Field(() => Int)
  readonly count!: number

  /**
   * Returns per-page entities limit
   */
  @Field(() => Int)
  readonly limit!: number

  /**
   * List offset
   */
  @Field(() => Int)
  readonly offset!: number

  /**
   * Returns the number of the current page
   */
  @Field(() => Int)
  current(@Root() {page}: PageParams<T>): number {
    return page
  }

  /**
   * Indicates whether the list has next page or not
   */
  @Field(() => Boolean)
  hasNext(@Root() {limit, page, count}: PageParams<T>): boolean {
    if (limit != null && page != null && count != null) {
      return count - limit * page > 0
    }

    return false
  }

  /**
   * Returns the number of the past page
   */
  @Field(() => Int)
  last(@Root() {limit, page, count}: PageParams<T>): number {
    if (limit != null && page != null && count != null) {
      return Math.ceil(count / (limit * page))
    }

    return 1
  }
{'fraction_non_alphanumeric': 0.15454906634882798, 'fraction_numerical': 0.001986491855383393, 'mean_word_length': 2.7193500738552436, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7133801', 'n_tokens_mistral': 816, 'n_tokens_neox': 787, 'n_words': 270}