<commit_before>'use babel';
'use strict';

export default function paginate(items, page, pageLength = 15) {
	if(page < 1) page = 1;
	let startIndex = (page - 1) * pageLength;
	if(startIndex > items.length) { startIndex = 0; page = 1; }
	const maxPage = Math.ceil(items.length / pageLength);
	return {
		items: items.length > pageLength ? items.slice(startIndex, startIndex + pageLength) : items,
		page: page,
		maxPage: maxPage,
		pageLength: 20,
		pageText: 'page ' + page + ' of ' + maxPage
	};<commit_msg>Improved paginator behaviour<commit_after>'use babel';
'use strict';

export default function paginate(items, page, pageLength = 15) {
	const maxPage = Math.ceil(items.length / pageLength);
	if(page < 1) page = 1;
	if(page > maxPage) page = maxPage;
	let startIndex = (page - 1) * pageLength;
	return {
		items: items.length > pageLength ? items.slice(startIndex, startIndex + pageLength) : items,
		page: page,
		maxPage: maxPage,
		pageLength: 20,
		pageText: 'page ' + page + ' of ' + maxPage
	};
{'fraction_non_alphanumeric': 0.1359126984126984, 'fraction_numerical': 0.015873015873015872, 'mean_word_length': 4.227979274611399, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '6682022', 'n_tokens_mistral': 370, 'n_tokens_neox': 342, 'n_words': 98}