<commit_before><?php defined('C5_EXECUTE') or die("Access Denied.");
$form = Loader::helper('form');
$th = Loader::helper('text');
 
// Arrays of (1) possible pages, and (2) currently selected pages
$options_array = array();
$selected_ids = array();
 
// If $selected is an array there must be pages selected already -- get their IDs
if (is_array($selected)) {
    foreach($selected as $key => $value){
        $selected_ids[] = $value;
    }
}
 
// If there is at least 1 page that can be selected, display a list. Otherwise warn the user that
// there are no options to choose from. This is determined by the filtering methods applied to
// the pagelist object in getAvailablePages() in controller.php
if (count($options) > 0) {
    echo '<fieldset>';
 
    // Loop through available options and output checkboxes, setting to checked where page IDs
    // match those in the array of selected page IDs
    foreach ($options as $key=>$option) {
        $checked = in_array($key, $selected_ids) ? 'checked="checked"' : '';
    ?>
 
        <label class="checkbox inline">
            <input type="checkbox" name="<?php echo $fieldPostName; ?>[]" value="<?php echo $key; ?>"<?php echo $selected; ?> />
            <?php echo $th->entities($option); ?>
        </label>
 
<?php }
    echo '</fieldset>';
} else {
 
    echo '<strong style="line-height:30px">There are no pages of this type to choose from.</strong>';
 
}<commit_msg>Fixed $checked in checkbox `input` tag<commit_after><?php defined('C5_EXECUTE') or die("Access Denied.");
$form = Loader::helper('form');
$th = Loader::helper('text');
 
// Arrays of (1) possible pages, and (2) currently selected pages
$options_array = array();
$selected_ids = array();
 
// If $selected is an array there must be pages selected already -- get their IDs
if (is_array($selected)) {
    foreach($selected as $key => $value){
        $selected_ids[] = $value;
    }
}
 
// If there is at least 1 page that can be selected, display a list. Otherwise warn the user that
// there are no options to choose from. This is determined by the filtering methods applied to
// the pagelist object in getAvailablePages() in controller.php
if (count($options) > 0) {
    echo '<fieldset>';
 
    // Loop through available options and output checkboxes, setting to checked where page IDs
    // match those in the array of selected page IDs
    foreach ($options as $key=>$option) {
        $checked = in_array($key, $selected_ids) ? ' checked="checked"' : '';
    ?>
 
        <label class="checkbox inline">
            <input type="checkbox" name="<?php echo $fieldPostName; ?>[]" value="<?php echo $key; ?>"<?php echo $checked; ?> />
            <?php echo $th->entities($option); ?>
        </label>
 
<?php }
    echo '</fieldset>';
} else {
 
    echo '<strong style="line-height:30px">There are no pages of this type to choose from.</strong>';
 
}
{'fraction_non_alphanumeric': 0.1466204506065858, 'fraction_numerical': 0.004852686308492201, 'mean_word_length': 3.419601837672282, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 35, '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': '6210521', 'n_tokens_mistral': 840, 'n_tokens_neox': 803, 'n_words': 317}