<commit_before># coding: utf-8

class Admin::TablesController < ApplicationController
  ssl_required :index, :show, :embed_map, :show_public, :index_public

  skip_before_filter :check_domain, :only => [:embed_map, :show, :show_public]
  skip_before_filter :browser_is_html5_compliant?, :only => [:embed_map]  
  before_filter :login_required, :only => [:index]

  def index
    current_page = params[:page].nil? ? 1 : params[:page].to_i
    per_page = 20
    
    # load top 100 tags
    @tags = Tag.load_user_tags(current_user.id, :limit => 100)
    
    @tables = if !params[:tag_name].blank?
      Table.find_all_by_user_id_and_tag(current_user.id, params[:tag_name]).order(:id).reverse.paginate(current_page, per_page)
    else
      Table.filter({:user_id => current_user.id}).order(:id).reverse.paginate(current_page, per_page)
    end

    # Quota (in Mb and Tables)
    @quota         = current_user.quota_in_bytes / 1024 / 1024
    @database_size = current_user.db_size_in_bytes / 1024 /1024
    @table_quota   = current_user.table_quota
    @tables_count  = @tables.pagination_record_count
  end
<commit_msg>enable basic table searches. closes #669<commit_after># coding: utf-8

class Admin::TablesController < ApplicationController
  ssl_required :index, :show, :embed_map, :show_public, :index_public

  skip_before_filter :check_domain, :only => [:embed_map, :show, :show_public]
  skip_before_filter :browser_is_html5_compliant?, :only => [:embed_map]  
  before_filter :login_required, :only => [:index]

  def index
    current_page = params[:page].nil? ? 1 : params[:page].to_i
    per_page = 20
    
    # load top 100 tags
    @tags = Tag.load_user_tags(current_user.id, :limit => 100)

    # Filter tables by tag, search, or return all. Paginated.
    @tables = if !params[:tag_name].blank?
      Table.find_all_by_user_id_and_tag(current_user.id, params[:tag_name]).order(:id).reverse.paginate(current_page, per_page)
    elsif !params[:q].blank?
      Table.filter("\"name\" LIKE ?", "%#{params[:q]}%").order(:id).reverse.paginate(current_page, per_page)
    else  
      Table.filter({:user_id => current_user.id}).order(:id).reverse.paginate(current_page, per_page)
    end

    # Quota (in Mb and Tables)
    @quota         = current_user.quota_in_bytes / 1024 / 1024
    @database_size = current_user.db_size_in_bytes / 1024 /1024
    @table_quota   = current_user.table_quota
    @tables_count  = @tables.pagination_record_count
  end

{'fraction_non_alphanumeric': 0.12626877791311408, 'fraction_numerical': 0.023142509135200974, 'mean_word_length': 4.187368421052631, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '812343', 'n_tokens_mistral': 911, 'n_tokens_neox': 843, 'n_words': 162}