def slice_page(path):
    """
    Function removes proper amount of characters from the end of a given path,
    so that it can later be appended in an altered form
    :param path: string (url path with filter and page parameters)
    :return: string (sliced path)
    """
    index = len(path) - 7
    if path.count('&page=') >= 1:
        while True:
            tmp = path.find('&page=', index)
            if tmp != -1:
                break
            else:
                index -= 1
        return path[:-(len(path) - index)]
    else:
        return path