<commit_before>class CoursesController < ApplicationController
  def show
    @course = Course.find(params[:id])
  end

  def index
    @recommended = Course.all.limit(3)
#TODO pagination etc
    if params[:topic_id]
      @topic = Topic.find(params[:topic_id])
      @courses = Course.where(subject: @topic.subjects)
    elsif params[:provider_id]
      @provider = Provider.find(params[:provider_id])
      @courses  = @provider.courses
    elsif params[:venue_id]
      @venue = Venue.find(params[:venue_id])
      @courses = @venue.courses
    elsif params[:q]
      @courses = Course.search(params[:q], {near: params[:near], sort: params[:sort], page: params[:page]})
    else
      @courses = Course.all.limit(50)
    end
    
  end
end
<commit_msg>add fix for paginated other queries<commit_after>class CoursesController < ApplicationController
  def show
    @course = Course.find(params[:id])
  end

  def index
    @recommended = Course.all.limit(3)
#TODO pagination etc
    if params[:topic_id]
      @topic = Topic.find(params[:topic_id])
      @courses = Course.where(subject: @topic.subjects).page(params[:page])
    elsif params[:provider_id]
      @provider = Provider.find(params[:provider_id])
      @courses  = @provider.courses.page(params[:page])
    elsif params[:venue_id]
      @venue = Venue.find(params[:venue_id])
      @courses = @venue.courses.page(params[:page])
    elsif params[:q]
      @courses = Course.search(params[:q], {near: params[:near], sort: params[:sort], page: params[:page]})
    else
      @courses = Course.all.limit(50)
    end
    
  end
end

{'fraction_non_alphanumeric': 0.13944723618090452, 'fraction_numerical': 0.0037688442211055275, 'mean_word_length': 3.590778097982709, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5200256', 'n_tokens_mistral': 533, 'n_tokens_neox': 520, 'n_words': 105}