<commit_before><?php
    $fixed_fields = array('synonyms', 'description', 'meta', 'authors', 'source');
    foreach ($data as $galaxy):
?>
        <div>
            <span title="<?php echo isset($galaxy['description']) ? h($galaxy['description']) : h($galaxy['name']);?>" class="bold blue" style="font-size:14px;">
                <?php echo h($galaxy['name']); ?>&nbsp;
            </span>
    <?php
        foreach ($galaxy['GalaxyCluster'] as $cluster):
            $cluster_fields = array();
            if (!empty($cluster['description'])) {
                $cluster_fields[] = array('key' => 'description', 'value' => $cluster['description']);
            }
            if (isset($cluster['meta']['synonyms'])) {
                $cluster_fields[] = array('key' => 'synonyms', 'value' => $cluster['meta']['synonyms']);
            }
            if (isset($cluster['source'])) {
                $cluster_fields[] = array('key' => 'source', 'value' => $cluster['source']);
            }
            if (isset($cluster['authors'])) {
                $cluster_fields[] = array('key' => 'authors', 'value' => $cluster['authors']);
            }
            if (!empty($cluster['meta'])) {
                foreach ($cluster['meta'] as $metaKey => $metaField) {
                    if ($metaKey != 'synonyms') {
                        $cluster_fields[] = array('key' => $metaKey, 'value' => $metaField);
                    }
                }
            }
            $popover_data = '<h4 class="blue bold">' . h($cluster['value']) . '</h4>';
            foreach ($cluster_fields as $cluster_field) {
                $key = sprintf('<span class="blue bold">%s</span>', Inflector::humanize(h($cluster_field['key'])));
                if (is_array($cluster_field['value'])) {
                    if ($cluster_field['key'] === 'refs') {
                        $value = array();
                        foreach ($cluster_field['value'] as $k => $v) {
                            $v_name = $v;
                            if (strlen($v_name) > 30) {
                                $v_name = substr($v, 0, 30) . '...';
                            }
                            $value[$k] = '<a href="' . h($v) . '" title="' . h($v) . '">' . h($v_name) . '</a>';
                        }
                        $value_contents = implode("<br>", $value);
                    } else if ($cluster_field['key'] === 'country') {
                        $value = array();
                        foreach ($cluster_field['value'] as $k => $v) {
                            $value[] = $this->Icon->countryFlag($v) . '&nbsp;' . h($v);
                        }
                        $value_contents = implode("<br>", $value);
                    } else {
                        $value_contents = nl2br(h(implode("\n", $cluster_field['value'])), false);
                    }
                } else {
                     if ($cluster_field['key'] === 'source' && filter_var($cluster_field['value'], FILTER_VALIDATE_URL)) {
                         $value_contents = '<a href="' . h($cluster_field['value']) . '">' . h($cluster_field['value']) . '</a>';
                     } else {
                        $value_contents = h($cluster_field['value']);
                     }
                }
                $value = sprintf('<span class="black">%s</span>', $value_contents);
                $popover_data .= "<span>$key: $value</span><br>";
            }
            echo sprintf(
                '<div class="large-left-margin">%s %s %s %s</div>',
                sprintf(<commit_msg>chg: [UI] Do not show refs for galaxy cluster popover, becasue links are not clickable<commit_after><?php
    $fixed_fields = array('synonyms', 'description', 'meta', 'authors', 'source');
    foreach ($data as $galaxy):
?>
        <div>
            <span title="<?php echo isset($galaxy['description']) ? h($galaxy['description']) : h($galaxy['name']);?>" class="bold blue" style="font-size:14px;">
                <?php echo h($galaxy['name']); ?>&nbsp;
            </span>
    <?php
        foreach ($galaxy['GalaxyCluster'] as $cluster):
            $cluster_fields = array();
            if (!empty($cluster['description'])) {
                $cluster_fields[] = array('key' => 'description', 'value' => $cluster['description']);
            }
            if (isset($cluster['meta']['synonyms'])) {
                $cluster_fields[] = array('key' => 'synonyms', 'value' => $cluster['meta']['synonyms']);
            }
            if (isset($cluster['source'])) {
                $cluster_fields[] = array('key' => 'source', 'value' => $cluster['source']);
            }
            if (isset($cluster['authors'])) {
                $cluster_fields[] = array('key' => 'authors', 'value' => $cluster['authors']);
            }
            if (!empty($cluster['meta'])) {
                foreach ($cluster['meta'] as $metaKey => $metaField) {
                    if ($metaKey != 'synonyms') {
                        $cluster_fields[] = array('key' => $metaKey, 'value' => $metaField);
                    }
                }
            }
            $popover_data = '<h4 class="blue bold">' . h($cluster['value']) . '</h4>';
            foreach ($cluster_fields as $cluster_field) {
                $key = sprintf('<span class="blue bold">%s</span>', Inflector::humanize(h($cluster_field['key'])));
                if (is_array($cluster_field['value'])) {
                    if ($cluster_field['key'] === 'refs') {
                        continue;
                    } else if ($cluster_field['key'] === 'country') {
                        $value = array();
                        foreach ($cluster_field['value'] as $k => $v) {
                            $value[] = $this->Icon->countryFlag($v) . '&nbsp;' . h($v);
                        }
                        $value_contents = implode("<br>", $value);
                    } else {
                        $value_contents = nl2br(h(implode("\n", $cluster_field['value'])), false);
                    }
                } else {
                     if ($cluster_field['key'] === 'source' && filter_var($cluster_field['value'], FILTER_VALIDATE_URL)) {
                         $value_contents = '<a href="' . h($cluster_field['value']) . '">' . h($cluster_field['value']) . '</a>';
                     } else {
                        $value_contents = h($cluster_field['value']);
                     }
                }
                $value = sprintf('<span class="black">%s</span>', $value_contents);
                $popover_data .= "<span>$key: $value</span><br>";
            }
            echo sprintf(
                '<div class="large-left-margin">%s %s %s %s</div>',
                sprintf(
{'fraction_non_alphanumeric': 0.1925925925925926, 'fraction_numerical': 0.0022222222222222222, 'mean_word_length': 1.6095863935059915, 'pattern_counts': {'":': 0, '<': 48, '<?xml version=': 0, '>': 76, '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': '4811173', 'n_tokens_mistral': 1858, 'n_tokens_neox': 1785, 'n_words': 339}