def build_pagination(page, limit, total):
    """ Generate the paging element of the results
    :rtype : object
    """
    pages = total / limit + min(1, total % limit)
    prev = max(1, page - 1) if page > 1 else None
    next = min(pages, page + 1) if page < pages else None
    return locals()
