def METHOD_NAME(page, page_size, photo_count):
    start = (page - 1) * page_size
    total = photo_count
    if start < 0:
        start = 0
    if start > total:
        start = total
    if int(start + page_size) > total:
        end = total
    else:
        end = start + page_size
    end = int(end)
    max_page = ceil(float(total) / float(page_size))
    if page > max_page:
        start, end, total, max_page, page = METHOD_NAME(max_page, page_size, photo_count)
    return start, end, total, max_page, page