def validate_num_results(request):
    """
    A utility for parsing the requested number of results per page.

    This should catch an invalid number of results and always return
    a valid number of results, defaulting to 25.
    """
    raw_results = request.GET.get('results')
    if raw_results in ['50', '100']:
        return int(raw_results)
    else:
        return 25