<commit_before><?php
/*
 * Bear CMS addon for Bear Framework
 * https://bearcms.com/
 * Copyright (c) 2016 Amplilabs Ltd.
 * Free to use under the MIT license.
 */

use BearCMS\Internal\ElementsHelper;

$blogPosts = $app->bearCMS->data->blog->getList();
$list = [];
foreach ($blogPosts as $blogPost) {
    if ($blogPost['status'] === 'published') {
        $list[] = $blogPost;
    }
}
usort($list, function($a, $b) {
    if ($a['publishedTime'] === $b['publishedTime']) {
        return 0;
    }
    return ($a['publishedTime'] > $b['publishedTime']) ? -1 : 1;
});

$type = 'full';
if (strlen($component->type) > 0) {
    if (array_search($component->type, ['summary', 'full', 'titles']) !== false) {
        $type = $component->type;
    }
}

$showDate = $component->showDate === 'true';
$limit = (int) $component->limit;
if ($limit < 1) {
    $limit = 5;
}

if (empty($list)) {
    $content = '';
} else {
    $content = '<div class="bearcms-blog-posts-element">';
    $content .= '<div class="bearcms-blog-posts-element-posts">';

    $counter = 0;
    foreach ($list as $blogPost) {
        $counter++;
        $title = isset($blogPost['title']) ? $blogPost['title'] : 'Unknown';
        $url = $app->request->base . '/b/' . (isset($blogPost['slug']) ? $blogPost['slug'] : 'unknown') . '/';
        $publishedTime = isset($blogPost['publishedTime']) ? $blogPost['publishedTime'] : '';

        $content .= '<div class="bearcms-blog-posts-element-post">';

        $content .= '<div class="bearcms-blog-posts-element-post-title-contaier">';
        $content .= '<a title="' . htmlentities($title) . '" class="bearcms-blog-posts-element-post-title" href="' . htmlentities($url) . '">' . htmlspecialchars($title) . '</a>';
        $content .= '</div>';
        if ($showDate) {
            $content .= '<div class="bearcms-blog-posts-element-post-date-container">';
            $content .= '<span class="bearcms-blog-posts-element-post-date">';<commit_msg>Class name typo fix.<commit_after><?php
/*
 * Bear CMS addon for Bear Framework
 * https://bearcms.com/
 * Copyright (c) 2016 Amplilabs Ltd.
 * Free to use under the MIT license.
 */

use BearCMS\Internal\ElementsHelper;

$blogPosts = $app->bearCMS->data->blog->getList();
$list = [];
foreach ($blogPosts as $blogPost) {
    if ($blogPost['status'] === 'published') {
        $list[] = $blogPost;
    }
}
usort($list, function($a, $b) {
    if ($a['publishedTime'] === $b['publishedTime']) {
        return 0;
    }
    return ($a['publishedTime'] > $b['publishedTime']) ? -1 : 1;
});

$type = 'full';
if (strlen($component->type) > 0) {
    if (array_search($component->type, ['summary', 'full', 'titles']) !== false) {
        $type = $component->type;
    }
}

$showDate = $component->showDate === 'true';
$limit = (int) $component->limit;
if ($limit < 1) {
    $limit = 5;
}

if (empty($list)) {
    $content = '';
} else {
    $content = '<div class="bearcms-blog-posts-element">';
    $content .= '<div class="bearcms-blog-posts-element-posts">';

    $counter = 0;
    foreach ($list as $blogPost) {
        $counter++;
        $title = isset($blogPost['title']) ? $blogPost['title'] : 'Unknown';
        $url = $app->request->base . '/b/' . (isset($blogPost['slug']) ? $blogPost['slug'] : 'unknown') . '/';
        $publishedTime = isset($blogPost['publishedTime']) ? $blogPost['publishedTime'] : '';

        $content .= '<div class="bearcms-blog-posts-element-post">';

        $content .= '<div class="bearcms-blog-posts-element-post-title-container">';
        $content .= '<a title="' . htmlentities($title) . '" class="bearcms-blog-posts-element-post-title" href="' . htmlentities($url) . '">' . htmlspecialchars($title) . '</a>';
        $content .= '</div>';
        if ($showDate) {
            $content .= '<div class="bearcms-blog-posts-element-post-date-container">';
            $content .= '<span class="bearcms-blog-posts-element-post-date">';
{'fraction_non_alphanumeric': 0.2245158002038736, 'fraction_numerical': 0.0056065239551478085, 'mean_word_length': 3.22497308934338, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 47, 'https://': 2, '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': '2966366', 'n_tokens_mistral': 1325, 'n_tokens_neox': 1280, 'n_words': 254}