<commit_before>{% macro thread_list(threads, forum=None) -%}
  <ol class="threads">
  {% for thread in threads.object_list %}
    {% if forum %}
      {% set _forum = forum %}
    {% else %}
      {% set _forum = thread.forum %}
    {% endif %}
    <li class="cf">
      <div class="type">
        {% if thread.is_locked %}
          <img src="{{ STATIC_URL }}img/blank.png" alt="{{ _('Locked', 'thread_type') }}" title="{{ _('Locked', 'thread_type') }}" class="icon-locked" />
        {% endif %}
        {% if thread.is_sticky %}
          <img src="{{ STATIC_URL }}img/blank.png" alt="{{ _('Sticky', 'thread_type') }}" title="{{ _('Sticky', 'thread_type') }}" class="icon-sticky" />
        {% endif %}
      </div>
      <div class="title"><a href="{{ url('forums.posts', forum_slug=_forum.slug, thread_id=thread.id)|urlparams(last=thread.last_post.id) }}">{{ thread.title }}</a></div>
      <div class="author"><a class="username" href="{{ profile_url(thread.creator) }}">{{ display_name(thread.creator) }}</a></div>
      <div class="replies">{{ thread.replies }}</div>
      <div class="last-post">
        <a href="{{ thread.get_last_post_url() }}">
          {{ datetimeformat(thread.last_post.created) }}
        </a><br/>
        {{ _('by <a class="username" href="{profile_url}">{username}</a>')|fe(profile_url=profile_url(thread.last_post.author), username=display_name(thread.last_post.author)) }}
      </div>
    </li>
  {% endfor %}
  </ol>
  {{ threads|paginator }}
{%- endmacro %}
<commit_msg>Don't 500 if forum thread is missing the last_post.<commit_after>{% macro thread_list(threads, forum=None) -%}
  <ol class="threads">
  {% for thread in threads.object_list %}
    {% if forum %}
      {% set _forum = forum %}
    {% else %}
      {% set _forum = thread.forum %}
    {% endif %}
    <li class="cf">
      <div class="type">
        {% if thread.is_locked %}
          <img src="{{ STATIC_URL }}img/blank.png" alt="{{ _('Locked', 'thread_type') }}" title="{{ _('Locked', 'thread_type') }}" class="icon-locked" />
        {% endif %}
        {% if thread.is_sticky %}
          <img src="{{ STATIC_URL }}img/blank.png" alt="{{ _('Sticky', 'thread_type') }}" title="{{ _('Sticky', 'thread_type') }}" class="icon-sticky" />
        {% endif %}
      </div>
      <div class="title"><a href="{{ url('forums.posts', forum_slug=_forum.slug, thread_id=thread.id)|urlparams(last=thread.last_post.id) }}">{{ thread.title }}</a></div>
      <div class="author"><a class="username" href="{{ profile_url(thread.creator) }}">{{ display_name(thread.creator) }}</a></div>
      <div class="replies">{{ thread.replies }}</div>
      {% if thread.last_post %}
        <div class="last-post">
          <a href="{{ thread.get_last_post_url() }}">
            {{ datetimeformat(thread.last_post.created) }}
          </a><br/>
          {{ _('by <a class="username" href="{profile_url}">{username}</a>')|fe(profile_url=profile_url(thread.last_post.author), username=display_name(thread.last_post.author)) }}
        </div>
      {% endif %}
    </li>
  {% endfor %}
  </ol>
  {{ threads|paginator }}
{%- endmacro %}

{'fraction_non_alphanumeric': 0.2237516005121639, 'fraction_numerical': 0.0009603072983354673, 'mean_word_length': 3.269125683060109, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 53, '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': '978187', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1036, 'n_words': 191}