diff --git a/app/views/case_logs/_log_list.html.erb b/app/views/case_logs/_log_list.html.erb
index 0450c04ad..130120de8 100644
--- a/app/views/case_logs/_log_list.html.erb
+++ b/app/views/case_logs/_log_list.html.erb
@@ -2,7 +2,7 @@
<%= govuk_table do |table| %>
<%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular], id: title.dasherize) do |caption| %>
- <% if searched.present? %>
+ <% if defined?(searched) && searched.present? %>
<%= pagy.count %> <%= item_label %> found matching ‘<%= searched %>’ of <%= total_count %> total <%= title.downcase %>. <%= govuk_link_to("Clear search", request.path) %>
<% else %>
<%= pagy.count %> total <%= title.downcase %>