<commit_before><?
/**
 * @param CloudControl\Cms\storage\Document $document
 * @param string $cmsPrefix
 * @param string $slugPrefix
 * @param bool $root
 * @param \CloudControl\Cms\cc\Request $request
 */
function renderFolder($document, $cmsPrefix, $slugPrefix = '', $root = false, $request)
{ ?>
  <div class="grid-box-8">
    <h3>
      <a class="btn documentTitle openFolder" data-slug="<?= $slugPrefix . $document->slug ?>" title="Open">
        <i class="fa fa-folder-o "></i> <?= $document->title ?>
      </a>
    </h3>
  </div>
  <div class="documentActions grid-box-4">
      <? renderAction('Edit',
          '',
          $request::$subfolders . $cmsPrefix . '/documents/edit-folder?slug=' . $slugPrefix . $document->slug,
          'pencil'); ?>
      <? renderAction('Delete',
          'error',
          $request::$subfolders . $cmsPrefix . '/documents/delete-folder?slug=' . $slugPrefix . $document->slug,
          'trash',
          'return confirm(\'Are you sure you want to delete this document?\');'); ?>
  </div>
  <ul class="documents grid-wrapper nested<?= $root ? ' root' : '' ?>">
      <? foreach ($document->getContent() as $subDocument) : ?>
        <li class="grid-container">
            <? if ($subDocument->type == 'document') : ?>
                <? renderDocument($subDocument, $cmsPrefix, $slugPrefix . $document->slug . '/', $request); ?>
            <? elseif ($subDocument->type == 'folder') : ?>
                <? renderFolder($subDocument, $cmsPrefix, $slugPrefix . $document->slug . '/', false, $request); ?>
            <? endif ?><commit_msg>Minor refactor in renderFolder to add conditions for renderActions<commit_after><?
/**
 * @param CloudControl\Cms\storage\Document $document
 * @param string $cmsPrefix
 * @param string $slugPrefix
 * @param bool $root
 * @param \CloudControl\Cms\cc\Request $request
 */
function renderFolder($document, $cmsPrefix, $slugPrefix = '', $root = false, $request)
{ ?>
  <div class="grid-box-8">
    <h3>
      <a class="btn documentTitle openFolder" data-slug="<?= $slugPrefix . $document->slug ?>" title="Open">
        <i class="fa fa-folder-o "></i> <?= $document->title ?>
      </a>
    </h3>
  </div>
  <div class="documentActions grid-box-4">
      <? renderAction(
          true,
          'Edit',
          '',
          $request::$subfolders . $cmsPrefix . '/documents/edit-folder?slug=' . $slugPrefix . $document->slug,
          'pencil'); ?>
      <? renderAction(
          true,
          'Delete',
          'error',
          $request::$subfolders . $cmsPrefix . '/documents/delete-folder?slug=' . $slugPrefix . $document->slug,
          'trash',
          'return confirm(\'Are you sure you want to delete this document?\');'); ?>
  </div>
  <ul class="documents grid-wrapper nested<?= $root ? ' root' : '' ?>">
      <? foreach ($document->getContent() as $subDocument) : ?>
        <li class="grid-container">
            <? if ($subDocument->type == 'document') : ?>
                <? renderDocument($subDocument, $cmsPrefix, $slugPrefix . $document->slug . '/', $request); ?>
            <? elseif ($subDocument->type == 'folder') : ?>
                <? renderFolder($subDocument, $cmsPrefix, $slugPrefix . $document->slug . '/', false, $request); ?>
            <? endif ?>
{'fraction_non_alphanumeric': 0.1923896499238965, 'fraction_numerical': 0.0024353120243531205, 'mean_word_length': 2.67973124300112, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 69, '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': '928768', 'n_tokens_mistral': 981, 'n_tokens_neox': 998, 'n_words': 214}