<commit_before>module Trade::TradeDataDownloadLogger

  module_function

  def log_download request, params
    unless params['origin'] == 'public' then return end
    data = {}
    # !! Not all the params can be sanitized with Trade::SearchParams.sanitize
    filters = Trade::SearchParams.sanitize(params['filters'])
    data["user_ip"] = request.ip
    data["report_type"] = params['filters']['report_type']
    data["year_from"] = filters[:time_range_start]<commit_msg>[#62051690] params[internal] == false<commit_after>module Trade::TradeDataDownloadLogger

  module_function

  def log_download request, params
    unless params['internal'] == false then return end
    data = {}
    # !! Not all the params can be sanitized with Trade::SearchParams.sanitize
    filters = Trade::SearchParams.sanitize(params['filters'])
    data["user_ip"] = request.ip
    data["report_type"] = params['filters']['report_type']
    data["year_from"] = filters[:time_range_start]
{'fraction_non_alphanumeric': 0.12899896800825594, 'fraction_numerical': 0.008255933952528379, 'mean_word_length': 5.217948717948718, 'pattern_counts': {'":': 0, '<': 3, '<?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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2393435', 'n_tokens_mistral': 282, 'n_tokens_neox': 274, 'n_words': 63}