<commit_before>class ItemsController < ApplicationController
  include ERB::Util
  include ApplicationHelper
  include FiltersHelper
  # GET /items
  # GET /items.json
  def index
    
    @filters = parseFilterParams(params)
    
    
    current_page = params[:page]
    current_page = 1 if current_page == nil
    current_page = Integer(current_page)
    per_page = 10
    pageNumber = calculateNumber(params)
    if pageNumber > (10000 - per_page +1)
      pageNumber = (10000 - per_page +1)
    end
    @items = WillPaginate::Collection.create(current_page, per_page, pageNumber) do |pager|
      start = (current_page-1)*per_page # assuming current_page is 1 based.
      pager.replace(Item.all(generateFilterSPARQLRequest(@filters),start,per_page))
    end

    gonItemsFiltersUri = Array.new
    @items.each do |element|
      element.localURI = item_path(:id => element, :old => @filters)
      gonItemsFiltersUri << element.localURI
    end
    gon.gonItemsFiltersUri = gonItemsFiltersUri
    
    @uriForItemsNumber = filters_getNumber_path(:old => @filters)
    gon.uriForItemsNumber = @uriForItemsNumber
    
    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @items }
    end
  end

  # GET /items/1
  # GET /items/1.json
  def show
    require 'cgi'
    require 'digest'
    
    @uri = URI.escape(CGI.unescape(params[:id]))
    if @uri[6] != '/'
      @uri = @uri.insert(6,'/')
    end
    @uri = CGI.escape(@uri)

    @uriHash = Digest::SHA1.hexdigest(@uri)
    
    @item = Item.find(@uri)
    
    @filters = parseFilterParams(params)
    
    render  :layout => 'empty'
  end
  

end<commit_msg>[#42272143] fix bug with stupid hack for tweets listing in zone-watcher<commit_after>class ItemsController < ApplicationController
  include ERB::Util
  include ApplicationHelper
  include FiltersHelper
  # GET /items
  # GET /items.json
  def index
    
    @filters = parseFilterParams(params)
    
    
    current_page = params[:page]
    current_page = 1 if current_page == nil
    current_page = Integer(current_page)
    per_page = 10
    pageNumber = calculateNumber(params)
    if pageNumber > (10000 - per_page +1)
      pageNumber = (10000 - per_page +1)
    end
    @items = WillPaginate::Collection.create(current_page, per_page, pageNumber) do |pager|
      start = (current_page-1)*per_page # assuming current_page is 1 based.
      pager.replace(Item.all(generateFilterSPARQLRequest(@filters),start,per_page))
    end

    gonItemsFiltersUri = Array.new
    @items.each do |element|
      element.localURI = item_path(:id => element, :old => @filters)
      gonItemsFiltersUri << element.localURI
    end
    gon.gonItemsFiltersUri = gonItemsFiltersUri
    
    @uriForItemsNumber = filters_getNumber_path(:old => @filters)
    gon.uriForItemsNumber = @uriForItemsNumber
        
    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @items }
    end
  end

  # GET /items/1
  # GET /items/1.json
  def show
    require 'cgi'
    require 'digest'
    @uri = params[:id]
    if params[:format] != nil
      @uri = @uri+"."+params[:format]
    end
    @uri = URI.escape(CGI.unescape(@uri))
    if @uri[6] != '/'
      @uri = @uri.insert(6,'/')
    end
    @uri = CGI.escape(@uri)

    @uriHash = Digest::SHA1.hexdigest(@uri)
    
    @item = Item.find(@uri)
    
    @filters = parseFilterParams(params)
    
    render  :layout => 'empty'
  end
  

end
{'fraction_non_alphanumeric': 0.11162388231900779, 'fraction_numerical': 0.014998557830977791, 'mean_word_length': 2.9098083427282977, 'pattern_counts': {'":': 0, '<': 9, '<?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': '7313237', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1130, 'n_words': 249}