<commit_before><?php

class dmRequestLogEntry extends dmLogEntry
{
  const MEM_ALERT   = 33554432;  // 32 Mb
  const TIME_ALERT  = 2000;      // 2 s
  
  protected static
  $browsersCache = array(),
  $usersCache    = array();
  
  public function configure(array $data)
  {
    $isXhr = $data['context']->getRequest()->isXmlHttpRequest();
    
    $uri = $this->cleanUri(dmArray::get($data['server'], 'PATH_INFO', $data['server']['REQUEST_URI']));
    
    $this->data = array(
      'time'          => (string) $data['server']['REQUEST_TIME'],
      'uri'           => dmString::truncate($uri, 500),
      'code'          => (string) $data['context']->getResponse()->getStatusCode(),
      'app'           => (string) sfConfig::get('sf_app'),
      'env'           => (string) sfConfig::get('sf_environment'),
      'ip'            => (string) $data['server']['REMOTE_ADDR'],
      'user_id'       => (string) $data['context']->getUser()->getUserId(),
      'user_agent'    => dmString::truncate($isXhr ? '' : $data['server']['HTTP_USER_AGENT'], 500),
      'xhr'           => (int)    $isXhr,
      'mem'           => (string) memory_get_peak_usage(true),
      'timer'         => (string) sprintf('%.0f', (microtime(true) - dm::getStartTime()) * 1000)<commit_msg>[Diem] fixed warning on dmRequestLogEntry when called from CLI<commit_after><?php

class dmRequestLogEntry extends dmLogEntry
{
  const MEM_ALERT   = 33554432;  // 32 Mb
  const TIME_ALERT  = 2000;      // 2 s
  
  protected static
  $browsersCache = array(),
  $usersCache    = array();
  
  public function configure(array $data)
  {
    $isXhr = $data['context']->getRequest()->isXmlHttpRequest();
    
    $uri = $this->cleanUri(dmArray::get($data['server'], 'PATH_INFO', $data['server']['REQUEST_URI']));
    
    $this->data = array(
      'time'          => (string) $data['server']['REQUEST_TIME'],
      'uri'           => dmString::truncate($uri, 500),
      'code'          => (string) $data['context']->getResponse()->getStatusCode(),
      'app'           => (string) sfConfig::get('sf_app'),
      'env'           => (string) sfConfig::get('sf_environment'),
      'ip'            => (string) $data['server']['REMOTE_ADDR'],
      'user_id'       => (string) $data['context']->getUser()->getUserId(),
      'user_agent'    => dmString::truncate($isXhr ? '' : isset($data['server']['HTTP_USER_AGENT']) ? $data['server']['HTTP_USER_AGENT'] : '', 500),
      'xhr'           => (int)    $isXhr,
      'mem'           => (string) memory_get_peak_usage(true),
      'timer'         => (string) sprintf('%.0f', (microtime(true) - dm::getStartTime()) * 1000)
{'fraction_non_alphanumeric': 0.1979483282674772, 'fraction_numerical': 0.019756838905775075, 'mean_word_length': 2.912332838038633, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, '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': '6980874', 'n_tokens_mistral': 919, 'n_tokens_neox': 853, 'n_words': 148}