<commit_before>from flask import abort, current_app
from showoff.lib import Paginator
import os, re

def _paginated_overview(album, page, endpoint='admin.list', template='grid'):
    files = os.listdir(os.path.join(current_app.config['ALBUMS_DIR'], album))

    ext = re.compile(".(jpg|png|gif|bmp)$", re.IGNORECASE)
    files = filter(ext.search, files)

    if len(files) == 0:
        abort(404)

    files.sort()

    return Paginator(album, files, current_app.config['THUMBNAILS_PER_PAGE'], page, endpoint, template)
<commit_msg>replace filter call with list comprehension; reverse files if show is set to reverse<commit_after>from flask import abort, current_app
from showoff.lib import Paginator, Show
import os, re

def _paginated_overview(album, page, endpoint='admin.list', template='grid'):
    show = Show(album)
    files = os.listdir(os.path.join(current_app.config['ALBUMS_DIR'], album))

    ext = re.compile(".(jpg|png|gif|bmp)$", re.IGNORECASE)
    files = [f for f in files if ext.search(f)]

    if len(files) == 0:
        abort(404)

    files.sort()

    if show.get_setting('reverse') == 'yes':
        files.reverse()

    return Paginator(album, files, current_app.config['THUMBNAILS_PER_PAGE'], page, endpoint, template)
{'fraction_non_alphanumeric': 0.13552526062550121, 'fraction_numerical': 0.006415396952686447, 'mean_word_length': 4.473684210526316, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2979806', 'n_tokens_mistral': 426, 'n_tokens_neox': 403, 'n_words': 101}