<?php
$listTitle = trim((string) ($listTitle ?? ''));
$listTitleActionsHtml = (string) ($listTitleActionsHtml ?? '');
$listTitleTag = strtolower(trim((string) ($listTitleTag ?? 'h1')));
$allowedTitleTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];

if (!in_array($listTitleTag, $allowedTitleTags, true)) {
    $listTitleTag = 'h1';
}
?>
<div class="app-list-titlebar">
  <<?php e($listTitleTag); ?>><?php e($listTitle); ?></<?php e($listTitleTag); ?>>
  <?php if (trim($listTitleActionsHtml) !== ''): ?>
    <div class="app-list-titlebar-actions">
      <?php echo $listTitleActionsHtml; // raw-html-ok: pre-built HTML from titlebar action renderer ?>
    </div>
  <?php endif; ?>
</div>
