def get_context_loop_positions(context):
    """
    Return the paginated current position within a loop,
    and the non-paginated position.
    """
    try:
        loop_counter = context['forloop']['counter']
    except KeyError:
        return 0, 0
    try:
        page = context['page_obj']
    except KeyError:
        return loop_counter, loop_counter
    total_loop_counter = (page.number - 1
        ) * page.paginator.per_page + loop_counter
    return total_loop_counter, loop_counter
