def pagination_links(route, path_parts, offset, limit, length_hint):
    path_str = '/'.join(path_parts)
    links = {'self': f'{route}/{path_str}?page[offset]={offset}&page[limit]={limit}', 'first': None, 'last': None, 'next': None, 'prev': None}
    if limit:
        last_page = (math.floor((length_hint / limit)) * limit)
        links.update({'first': f'{route}/{path_str}?page[offset]={0}&page[limit]={limit}', 'last': f'{route}/{path_str}?page[offset]={last_page}&page[limit]={limit}'})
    if ((offset + limit) < length_hint):
        links['next'] = f'{route}/{path_str}?page[offset]={(offset + limit)}&page[limit]={limit}'
    if (offset > 0):
        links['prev'] = f'{route}/{path_str}?page[offset]={max(0, (offset - limit))}&page[limit]={limit}'
    return links
def pagination_links(route, path_parts, offset, limit, length_hint):
    path_str = '/'.join(path_parts)
    links = {'self': f'{route}/{path_str}?page[offset]={offset}&page[limit]={limit}', 'first': None, 'last': None, 'next': None, 'prev': None}
    if limit:
        last_page = (math.floor((length_hint / limit)) * limit)
        links.update({'first': f'{route}/{path_str}?page[offset]={0}&page[limit]={limit}', 'last': f'{route}/{path_str}?page[offset]={last_page}&page[limit]={limit}'})
    if ((offset + limit) < length_hint):
        links['next'] = f'{route}/{path_str}?page[offset]={(offset + limit)}&page[limit]={limit}'
    if (offset > 0):
        links['prev'] = f'{route}/{path_str}?page[offset]={max(0, (offset - limit))}&page[limit]={limit}'
    return links