<commit_before>class MapDisplayController < ApplicationController
  def map
    # Select Leaflet image based on browser
    browser = Browser.new(request.user_agent)

    @extension = (browser.chrome? || browser.firefox? || browser.safari?) ? ".svg" : ".png"
    @extension = ".png" if browser.platform.ios? || browser.platform.android?

    # Read URL params
    @shelfmark = params[:shelfmark]
    @original_shelfmark = @shelfmark.dup
    identifier = params[:identifier] || 'lc_hub'
    @library = params[:library] || 'main'
    @floor = params[:floor] || 1
    @title = params[:title]
    @author = params[:author]
    @element_name = params[:element_name]
    session[:ui_view] = params[:view] if session[:ui_view].nil?

    #search for the icons
    if @element_name
      @searching = true
      @elementnames = Element.joins(:element_type).where("elements.library = :library AND elements.floor = :floor AND element_types.name like :name", {library: @library, floor: @floor, name: "%#{params[:element_name]}%"})
    end
    # If URL is passing parameters
    if @shelfmark
        @searching = true
        
        unless browser.platform.ios? or browser.platform.android? or browser.platform.windows_phone?
          @qr = RQRCode::QRCode.new(request.original_url)
        end
        @elements = Element.find_shelf(@library, identifier, @shelfmark)<commit_msg>Only duplicating shelfmark if it's passed as a param<commit_after>class MapDisplayController < ApplicationController
  def map
    # Select Leaflet image based on browser
    browser = Browser.new(request.user_agent)

    @extension = (browser.chrome? || browser.firefox? || browser.safari?) ? ".svg" : ".png"
    @extension = ".png" if browser.platform.ios? || browser.platform.android?

    # Read URL params
    @shelfmark = params[:shelfmark]
    identifier = params[:identifier] || 'lc_hub'
    @library = params[:library] || 'main'
    @floor = params[:floor] || 1
    @title = params[:title]
    @author = params[:author]
    @element_name = params[:element_name]
    session[:ui_view] = params[:view] if session[:ui_view].nil?

    #search for the icons
    if @element_name
      @searching = true
      @elementnames = Element.joins(:element_type).where("elements.library = :library AND elements.floor = :floor AND element_types.name like :name", {library: @library, floor: @floor, name: "%#{params[:element_name]}%"})
    end
    # If URL is passing parameters
    if @shelfmark
        @searching = true
        @original_shelfmark = @shelfmark.dup

        unless browser.platform.ios? or browser.platform.android? or browser.platform.windows_phone?
          @qr = RQRCode::QRCode.new(request.original_url)
        end
        @elements = Element.find_shelf(@library, identifier, @shelfmark)
{'fraction_non_alphanumeric': 0.12936936936936938, 'fraction_numerical': 0.0007207207207207207, 'mean_word_length': 3.603648424543947, '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': '3507460', 'n_tokens_mistral': 851, 'n_tokens_neox': 812, 'n_words': 201}