<commit_before><?php

/**
 * @var \JasonGrimes\Paginator $paginator
 */

use PHPCensor\Helper\Lang;

?>
<script>
    var PROJECT_ID     = <?= $project->getId(); ?>;
    var PROJECT_ENVIRONMENT = '<?= $environment; ?>';
    var PROJECT_BRANCH = '<?= $branch; ?>';
    var PER_PAGE       = <?= $perPage; ?>;
    var PAGE           = <?= $page; ?>;
</script>

<div class="clearfix"  style="margin-bottom: 20px;">
    <a class="btn btn-default" href="<?= APP_URL . 'project/edit/' . $project->getId(); ?>">
        <?php Lang::out('edit_project'); ?>
    </a>

    <a class="btn btn-danger" id="delete-project">
        <?php Lang::out('delete_project'); ?>
    </a>

    <?php
        $build_url = APP_URL . 'project/build/' . $project->getId();
    ?>
    <div class="pull-right btn-group">
        <?php if (!$project->getArchived()): ?>
            <?php if ($this->User()->getIsAdmin()): ?>
                <?php if (!empty($environment)): ?>
                    <a class="btn btn-danger" href="<?= $build_url . '?' . http_build_query(['type' => 'environment', 'id' => $environment, 'debug' => 1]); ?>">
                        <?php Lang::out('build_now_debug'); ?>
                    </a>
                <?php elseif (!empty($branch)): ?>
                    <a class="btn btn-danger" href="<?= $build_url . '?' . http_build_query(['type' => 'branch', 'id' => $branch, 'debug' => 1]); ?>">
                        <?php Lang::out('build_now_debug'); ?>
                    </a>
                <?php else: ?>
                    <a class="btn btn-danger" href="<?= $build_url . '?' . http_build_query(['debug' => 1]); ?>">
                        <?php Lang::out('build_now_debug'); ?>
                    </a>
                <?php endif; ?>
            <?php endif; ?>

            <?php if (!empty($environment)): ?>
                <a class="btn btn-success" href="<?= $build_url . '?' . http_build_query(['type' => 'environment', 'id' => $environment]); ?>">
                    <?php Lang::out('build_now'); ?>
                </a>
            <?php elseif (!empty($branch)): ?>
                <a class="btn btn-success" href="<?= $build_url . '?' . http_build_query(['type' => 'branch', 'id' => $branch]); ?>">
                    <?php Lang::out('build_now'); ?>
                </a>
            <?php else: ?>
                <a class="btn btn-success" href="<?= $build_url; ?>">
                    <?php Lang::out('build_now'); ?>
                </a>
            <?php endif; ?>
        <?php endif; ?>

        <div class="btn-group branch-btn pull-right">
            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                <?php if (!empty($environment)) {
                    Lang::out('environment_x', $environment);
                } elseif (!empty($branch)) {
                    Lang::out('branch_x', $branch);
                } else {
                    Lang::out('all');
                } ?>&nbsp;&nbsp;<span class="caret"></span>
            </button>

            <ul class="dropdown-menu" role="menu">
                <li><a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>"><?php Lang::out('all'); ?></a></li>
                <li class="divider"></li>

                <?php if(!empty($environments)): ?>
                    <?php foreach ($environments as $currentEnvironment) : ?>
                        <li <?= ($currentEnvironment == $environment) ? 'class="active"' : ''; ?>>
                            <a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>?environment=<?= urlencode($currentEnvironment); ?>">
                                <i class="fa fa-cog"></i><?= $currentEnvironment; ?>
                            </a>
                        </li>
                    <?php endforeach; ?>
                    <li class="divider"></li>
                <?php endif; ?>

                <?php foreach ($branches as $currentBranch) : ?>
                    <li <?= ($currentBranch == $branch) ? 'class="active"' : ''; ?>>
                        <a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>?branch=<?= urlencode($currentBranch); ?>">
                            <i class="fa fa-code-fork"></i><?= $currentBranch; ?>
                        </a>
                    </li>
                <?php endforeach; ?>
            </ul>
        </div>
    </div>
</div>


<div class="row">
    <div class="col-lg-9 col-md-8 col-sm-8">
        <div class="box">
            <div class="box-header">
                <h3 class="box-title"><?php Lang::out('builds'); ?> (<?= $total; ?>)</h3>
            </div>
            <table class="table table-hover">
                <thead>
                <tr>
                    <th><?php Lang::out('id'); ?></th>
                    <th><?php Lang::out('status'); ?></th>
                    <th><?php Lang::out('date'); ?></th>
                    <th><?php Lang::out('build_source'); ?></th>
                    <th class="hidden-md hidden-sm hidden-xs"><?php Lang::out('commit'); ?></th>
                    <th><?php Lang::out('branch'); ?></th>
                    <th><?php Lang::out('environment'); ?></th>
                    <th><?php Lang::out('duration'); ?></th>
                    <th><?php Lang::out('new_errors'); ?></th>
                    <th></th>
                </tr>
                </thead>
                <tbody id="latest-builds">
                    <?= $builds; ?>
                </tbody>
            </table>
        </div>
        <div id="paginator">
            <?= $paginator; ?>
        </div>
    </div>

    <div class="col-lg-3 col-md-4 col-sm-4">

        <?php if ($project->getAllowPublicStatus() && !$project->getArchived()): ?>
            <div class="box">
                <div class="box-header">
                    <h4 class="box-title"><?= Lang::get('public_status_title'); ?></h4>
                    <div class="box-tools pull-right">
                        <button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
                            <i class="fa fa-minus"></i>
                        </button>
                    </div>
                </div>

                <div class="box-body">
                    <span style="word-wrap: break-word;">
                        <a href="<?= APP_URL . 'build-status/view/' . $project->getId() . '?branch=master'; ?>">
                            <img src="<?= APP_URL . 'build-status/image/' . $project->getId() . '?branch=master&label=PHPCensor&style=flat-square'; ?>" />
                        </a>

                        <br /><br />
                        <?= Lang::get('public_status_image'); ?>:<br /><strong><?= APP_URL . 'build-status/image/' . $project->getId() . '?branch=master&label=PHPCensor&style=flat-square'; ?></strong>

                        <br /><br />
                        <?= Lang::get('public_status_page'); ?>:<br /><strong><?= APP_URL . 'build-status/view/' . $project->getId() . '?branch=master'; ?></strong>
                    </span>
                </div>
            </div><commit_msg>Fixed public status widget for archived projects.<commit_after><?php

/**
 * @var \JasonGrimes\Paginator $paginator
 */

use PHPCensor\Helper\Lang;

?>
<script>
    var PROJECT_ID     = <?= $project->getId(); ?>;
    var PROJECT_ENVIRONMENT = '<?= $environment; ?>';
    var PROJECT_BRANCH = '<?= $branch; ?>';
    var PER_PAGE       = <?= $perPage; ?>;
    var PAGE           = <?= $page; ?>;
</script>

<div class="clearfix"  style="margin-bottom: 20px;">
    <a class="btn btn-default" href="<?= APP_URL . 'project/edit/' . $project->getId(); ?>">
        <?php Lang::out('edit_project'); ?>
    </a>

    <a class="btn btn-danger" id="delete-project">
        <?php Lang::out('delete_project'); ?>
    </a>

    <?php
        $build_url = APP_URL . 'project/build/' . $project->getId();
    ?>
    <div class="pull-right btn-group">
        <?php if (!$project->getArchived()): ?>
            <?php if ($this->User()->getIsAdmin()): ?>
                <?php if (!empty($environment)): ?>
                    <a class="btn btn-danger" href="<?= $build_url . '?' . http_build_query(['type' => 'environment', 'id' => $environment, 'debug' => 1]); ?>">
                        <?php Lang::out('build_now_debug'); ?>
                    </a>
                <?php elseif (!empty($branch)): ?>
                    <a class="btn btn-danger" href="<?= $build_url . '?' . http_build_query(['type' => 'branch', 'id' => $branch, 'debug' => 1]); ?>">
                        <?php Lang::out('build_now_debug'); ?>
                    </a>
                <?php else: ?>
                    <a class="btn btn-danger" href="<?= $build_url . '?' . http_build_query(['debug' => 1]); ?>">
                        <?php Lang::out('build_now_debug'); ?>
                    </a>
                <?php endif; ?>
            <?php endif; ?>

            <?php if (!empty($environment)): ?>
                <a class="btn btn-success" href="<?= $build_url . '?' . http_build_query(['type' => 'environment', 'id' => $environment]); ?>">
                    <?php Lang::out('build_now'); ?>
                </a>
            <?php elseif (!empty($branch)): ?>
                <a class="btn btn-success" href="<?= $build_url . '?' . http_build_query(['type' => 'branch', 'id' => $branch]); ?>">
                    <?php Lang::out('build_now'); ?>
                </a>
            <?php else: ?>
                <a class="btn btn-success" href="<?= $build_url; ?>">
                    <?php Lang::out('build_now'); ?>
                </a>
            <?php endif; ?>
        <?php endif; ?>

        <div class="btn-group branch-btn pull-right">
            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                <?php if (!empty($environment)) {
                    Lang::out('environment_x', $environment);
                } elseif (!empty($branch)) {
                    Lang::out('branch_x', $branch);
                } else {
                    Lang::out('all');
                } ?>&nbsp;&nbsp;<span class="caret"></span>
            </button>

            <ul class="dropdown-menu" role="menu">
                <li><a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>"><?php Lang::out('all'); ?></a></li>
                <li class="divider"></li>

                <?php if(!empty($environments)): ?>
                    <?php foreach ($environments as $currentEnvironment) : ?>
                        <li <?= ($currentEnvironment == $environment) ? 'class="active"' : ''; ?>>
                            <a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>?environment=<?= urlencode($currentEnvironment); ?>">
                                <i class="fa fa-cog"></i><?= $currentEnvironment; ?>
                            </a>
                        </li>
                    <?php endforeach; ?>
                    <li class="divider"></li>
                <?php endif; ?>

                <?php foreach ($branches as $currentBranch) : ?>
                    <li <?= ($currentBranch == $branch) ? 'class="active"' : ''; ?>>
                        <a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>?branch=<?= urlencode($currentBranch); ?>">
                            <i class="fa fa-code-fork"></i><?= $currentBranch; ?>
                        </a>
                    </li>
                <?php endforeach; ?>
            </ul>
        </div>
    </div>
</div>


<div class="row">
    <div class="col-lg-9 col-md-8 col-sm-8">
        <div class="box">
            <div class="box-header">
                <h3 class="box-title"><?php Lang::out('builds'); ?> (<?= $total; ?>)</h3>
            </div>
            <table class="table table-hover">
                <thead>
                <tr>
                    <th><?php Lang::out('id'); ?></th>
                    <th><?php Lang::out('status'); ?></th>
                    <th><?php Lang::out('date'); ?></th>
                    <th><?php Lang::out('build_source'); ?></th>
                    <th class="hidden-md hidden-sm hidden-xs"><?php Lang::out('commit'); ?></th>
                    <th><?php Lang::out('branch'); ?></th>
                    <th><?php Lang::out('environment'); ?></th>
                    <th><?php Lang::out('duration'); ?></th>
                    <th><?php Lang::out('new_errors'); ?></th>
                    <th></th>
                </tr>
                </thead>
                <tbody id="latest-builds">
                    <?= $builds; ?>
                </tbody>
            </table>
        </div>
        <div id="paginator">
            <?= $paginator; ?>
        </div>
    </div>

    <div class="col-lg-3 col-md-4 col-sm-4">

        <?php if ($project->getAllowPublicStatus()): ?>
            <div class="box">
                <div class="box-header">
                    <h4 class="box-title"><?= Lang::get('public_status_title'); ?></h4>
                    <div class="box-tools pull-right">
                        <button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
                            <i class="fa fa-minus"></i>
                        </button>
                    </div>
                </div>

                <div class="box-body">
                    <span style="word-wrap: break-word;">
                        <a href="<?= APP_URL . 'build-status/view/' . $project->getId() . '?branch=master'; ?>">
                            <img src="<?= APP_URL . 'build-status/image/' . $project->getId() . '?branch=master&label=PHPCensor&style=flat-square'; ?>" />
                        </a>

                        <br /><br />
                        <?= Lang::get('public_status_image'); ?>:<br /><strong><?= APP_URL . 'build-status/image/' . $project->getId() . '?branch=master&label=PHPCensor&style=flat-square'; ?></strong>

                        <br /><br />
                        <?= Lang::get('public_status_page'); ?>:<br /><strong><?= APP_URL . 'build-status/view/' . $project->getId() . '?branch=master'; ?></strong>
                    </span>
                </div>
            </div>
{'fraction_non_alphanumeric': 0.2109648508612239, 'fraction_numerical': 0.002100546141996919, 'mean_word_length': 1.5500803427959293, 'pattern_counts': {'":': 0, '<': 391, '<?xml version=': 0, '>': 442, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1351242', 'n_tokens_mistral': 4186, 'n_tokens_neox': 4047, 'n_words': 774}