<commit_before>class DsTabsController < ApplicationController
  before_filter :get_setting
  theme :get_theme

  caches_action :show, :cache_path => Proc.new { |c| "tabs_#{params[:id]}" + c.params.to_s }
  # GET /tabs
  # GET /tabs.xml
  def index
    @d = D.find(params[:d])

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @tabs }
    end
  end

  def datatable
    @d = D.find(params[:d])
    @records = current_records(@d, params)
    @total_records = total_records(@d)

    respond_to do |format|
      format.js {render :layout => false}
    end
  end

  # GET /tabs/1
  # GET /tabs/1.xml
  def show
    begin
      @tab = nil

      if params[:id]
        # loop all the tab datasource and find the first one has the specific slug
        tab_ds = D.where(:ds_type => "Tab")
        tab_ds.each do |d|
          begin
            @tab = d.get_klass.find(:first, :conditions => {:slug => params[:id]}) || d.get_klass.find(params[:id])
          rescue Mongoid::Errors::DocumentNotFound
          end
          if @tab
            break
          end
        end
      end

      # get the first tab datasource's root
      unless @tab
        @tab = D.where(:ds_type => "Tab").first.get_klass.root
      end

      if @tab
        @page = @tab.page

        if @page<commit_msg>fix no tab found prob<commit_after>class DsTabsController < ApplicationController
  before_filter :get_setting
  theme :get_theme

  caches_action :show, :cache_path => Proc.new { |c| "tabs_#{params[:id]}" + c.params.to_s }
  # GET /tabs
  # GET /tabs.xml
  def index
    @d = D.find(params[:d])

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @tabs }
    end
  end

  def datatable
    @d = D.find(params[:d])
    @records = current_records(@d, params)
    @total_records = total_records(@d)

    respond_to do |format|
      format.js {render :layout => false}
    end
  end

  # GET /tabs/1
  # GET /tabs/1.xml
  def show
    begin
      @tab = nil

      if params[:id]
        # loop all the tab datasource and find the first one has the specific slug
        tab_ds = D.where(:ds_type => "Tab")
        tab_ds.each do |d|
          begin
            @tab = d.get_klass.find(:first, :conditions => {:slug => params[:id]}) || d.get_klass.find(params[:id])
          rescue Mongoid::Errors::DocumentNotFound
          end
          if @tab
            break
          end
        end
      end

      # get the first tab datasource's root
      unless @tab
        @tab = D.where(:ds_type => "Tab").first.get_klass.root if D.where(:ds_type => "Tab").count > 0 
      end

      if @tab
        @page = @tab.page

        if @page
{'fraction_non_alphanumeric': 0.12154696132596685, 'fraction_numerical': 0.001841620626151013, 'mean_word_length': 2.0793650793650795, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '5814951', 'n_tokens_mistral': 916, 'n_tokens_neox': 895, 'n_words': 239}