<commit_before><% page_title t("document.latest_from", subject: subject) %>
<% page_class "documents-index" %>
<% atom_discovery_link_tag filter_atom_feed_url, "Recent documents" %>

<header class="block headings-block">
  <div class="govuk-width-container">
    <% if  subject.is_a? Organisation %>
      <%= render "govuk_publishing_components/components/breadcrumbs", {
        breadcrumbs: [
          {
            title: "Home",
            url: "/",
          },
          {
            title: "Organisations",
            url: "/government/organisations",
          },
          {
            title: "#{subject}",
            url: "/government/organisations/#{subject['slug']}",
          },
        ]
      } %>
    <% elsif subject&.type == "TopicalEvent" %>
        <%= render "govuk_publishing_components/components/breadcrumbs", {
          breadcrumbs: [
            {
              title: "Home",
              url: "/",
            },
            {
              title: "Topical events",
              url: "/government/topical-events",
            },
            {
              title: "#{subject}",
              url: "/government/topical-events/#{subject['slug']}",
            },
          ]
        } %>
    <% end %>
    <%= render "govuk_publishing_components/components/title", {
      context: {
        text: subject,
      },
      title: t("document.latest"),
    } %>
  </div>
</header>
<div class="block results">
  <div class="inner-block">
    <%= render "shared/feeds", atom_url: atom_feed_url_for(subject) %>
    <%= render "rummager_documents", documents: documents %>
    <%= paginate documents %>
  </div>
</div>
<commit_msg>Fix 500s due to type not being available<commit_after><% page_title t("document.latest_from", subject: subject) %>
<% page_class "documents-index" %>
<% atom_discovery_link_tag filter_atom_feed_url, "Recent documents" %>

<header class="block headings-block">
  <div class="govuk-width-container">
    <% if  subject.is_a? Organisation %>
      <%= render "govuk_publishing_components/components/breadcrumbs", {
        breadcrumbs: [
          {
            title: "Home",
            url: "/",
          },
          {
            title: "Organisations",
            url: "/government/organisations",
          },
          {
            title: "#{subject}",
            url: "/government/organisations/#{subject['slug']}",
          },
        ]
      } %>
    <% elsif subject.is_a? TopicalEvent %>
        <%= render "govuk_publishing_components/components/breadcrumbs", {
          breadcrumbs: [
            {
              title: "Home",
              url: "/",
            },
            {
              title: "Topical events",
              url: "/government/topical-events",
            },
            {
              title: "#{subject}",
              url: "/government/topical-events/#{subject['slug']}",
            },
          ]
        } %>
    <% else subject.is_a? WorldLocation %>
      <%= render "govuk_publishing_components/components/breadcrumbs", {
          breadcrumbs: [
            {
              title: "Home",
              url: "/",
            },
            {
              title: "Help and services around the world",
              url: "/government/world",
            },
            {
              title: "#{subject}",
              url: "/government/world/#{subject['slug']}",
            },
          ]
        } %>
    <% end %>
    <%= render "govuk_publishing_components/components/title", {
      context: {
        text: subject,
      },
      title: t("document.latest"),
    } %>
  </div>
</header>
<div class="block results">
  <div class="inner-block">
    <%= render "shared/feeds", atom_url: atom_feed_url_for(subject) %>
    <%= render "rummager_documents", documents: documents %>
    <%= paginate documents %>
  </div>
</div>

{'fraction_non_alphanumeric': 0.15500650195058518, 'fraction_numerical': 0.0007802340702210664, 'mean_word_length': 1.7257264351523742, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, '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': '7463117', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1091, 'n_words': 185}