<commit_before><?php
require '../scat.php';

$q= "SELECT id, name FROM brand WHERE name != '' ORDER BY name";
$r= $db->query($q)
  or die_query($db, $q);

$brands= array();
while ($row= $r->fetch_row()) {
  $brands[$row[0]]= $row[1];
}
$brands['selected']= $_REQUEST['id'];

echo jsonp($brands);<commit_msg>Add 'verbose' mode for brand list to preserve item order<commit_after><?php
require '../scat.php';

$verbose= (int)$_REQUEST['verbose'];

$q= "SELECT id, name FROM brand WHERE name != '' ORDER BY name";
$r= $db->query($q)
  or die_query($db, $q);

$brands= array();
while ($row= $r->fetch_row()) {
  if ($verbose) {
    $brands[]= array('id' => $row[0], 'name' => $row[1]);
  } else {
    $brands[$row[0]]= $row[1];
  }
}

if ($_REQUEST['id'])
  $brands['selected']= $_REQUEST['id'];

echo jsonp($brands);
{'fraction_non_alphanumeric': 0.2536945812807882, 'fraction_numerical': 0.007389162561576354, 'mean_word_length': 4.977941176470588, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '2050691', 'n_tokens_mistral': 320, 'n_tokens_neox': 319, 'n_words': 80}