<commit_before>import './list-paginator.less';
import template from 'components/list-paginator/list-paginator.html';
import register from 'components/component-registrator';

import {pageSizes, initialPage} from 'constants/pagination';

class ListPaginatorViewModel {
    constructor(params) {
        this.pageSizes = pageSizes;

        this.currentPage = params.currentPage;
        this.pageCount = params.pageCount;
        this.pageSize = params.pageSize;
        this.pageCountSubscription = this.pageCount.subscribe(() => {
            this.currentPage(initialPage);
        });
        this.pageSizeSubscription = this.pageSize.subscribe(() => {
            this.currentPage(initialPage);
        });
    }

    dispose() {
        this.pageCountSubscription.dispose();
        this.pageSizeSubscription.dispose();
    }

    goToPreviousPage() {
        if (this.currentPage() > 1) {
            this.currentPage(this.currentPage() - 1);
        }
    }

    goToNextPage() {
        if (this.pageCount() > this.currentPage()) {
            this.currentPage(this.currentPage() + 1);
        }
    }

    goToFirstPage() {
        this.currentPage(1);
    }

    goToLastPage() {<commit_msg>Created class method to go to initial page<commit_after>import './list-paginator.less';
import template from 'components/list-paginator/list-paginator.html';
import register from 'components/component-registrator';

import {pageSizes, initialPage} from 'constants/pagination';

class ListPaginatorViewModel {
    constructor(params) {
        this.pageSizes = pageSizes;

        this.currentPage = params.currentPage;
        this.pageCount = params.pageCount;
        this.pageSize = params.pageSize;

        this.pageCountSubscription = this.pageCount.subscribe(() => {
            this.goToInitialPage();
        });
        this.pageSizeSubscription = this.pageSize.subscribe(() => {
            this.goToInitialPage();
        });
    }

    dispose() {
        this.pageCountSubscription.dispose();
        this.pageSizeSubscription.dispose();
    }

    goToInitialPage() {
        this.currentPage(initialPage);
    }

    goToPreviousPage() {
        if (this.currentPage() > 1) {
            this.currentPage(this.currentPage() - 1);
        }
    }

    goToNextPage() {
        if (this.pageCount() > this.currentPage()) {
            this.currentPage(this.currentPage() + 1);
        }
    }

    goToFirstPage() {
        this.currentPage(1);
    }

    goToLastPage() {
{'fraction_non_alphanumeric': 0.1255028157683025, 'fraction_numerical': 0.003218020917135961, 'mean_word_length': 2.488078541374474, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '822907', 'n_tokens_mistral': 721, 'n_tokens_neox': 716, 'n_words': 109}