def define_pagination_variables(limit, offset, homophonesGroupCollection):
	""" Define previous URL, next URL, total number of pages and current page based
	on the limit and offset. """

	if offset - limit < 0:
		prevURL = None
	else:
		prevURL = f'/p/?limit={limit}&offset={offset - limit}'

	totalDocuments = homophonesGroupCollection.count_documents({})
	if offset + limit >= totalDocuments:
		nextURL = None
	else:
		nextURL = f'/p/?limit={limit}&offset={offset + limit}'

	totalPages = (totalDocuments // limit) + 1
	currentPage = (offset // limit) + 1

	return (prevURL, nextURL, totalPages, currentPage)