tem/tenant/what_web.sql

              SELECT 'dynamic' AS component, sqlpage.run_sql('shell/shell.sql') AS properties;
              -- not including breadcrumbs from sqlpage_aide_navigation
              -- not including page title from sqlpage_aide_navigation
              

              SELECT 'title' AS component, (SELECT COALESCE(title, caption)
    FROM sqlpage_aide_navigation
   WHERE namespace = 'prime' AND path = 'tem/tenant/what_web.sql/index.sql') as contents;
    ;
  --- Display breadcrumb
  SELECT
      'breadcrumb' AS component;
  SELECT
      'Home' AS title,
      sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/'    AS link;
  SELECT
      'Threat Exposure Management' AS title,
      sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/tem/index.sql' AS link;  
  SELECT 'Attack Surface Mapping By Tenant' AS title,
      sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/tem/attack_surface_mapping_tenant.sql' AS link;
  SELECT tenant_name AS title,
      sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/tem/tenant/attack_surface_mapping_inner.sql?tenant_id=' || $tenant_id AS link FROM tem_tenant WHERE tenant_id=$tenant_id;
  SELECT 'Findings' AS title,
          sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/tem/tenant/finding.sql?tenant_id=' || $tenant_id AS link;
  SELECT 'Web Technology Fingerprinting' AS title,
      '#' AS link;

  --- Dsply Page Title
  SELECT
    'title'   as component,
    'Web Technology Fingerprinting' as contents;

  SELECT
    'text'              as component,
    'This page displays the results of automated web technology fingerprinting using WhatWeb. It includes details about detected servers, technologies, HTTP responses, geolocation, and key headers for each scanned endpoint.' as contents;
  

  SELECT 'table' AS component,
 TRUE AS sort,
 'http_status' AS markdown,
 TRUE AS search;
 
  SET total_rows = (SELECT COUNT(*) FROM tem_what_web_result WHERE tenant_id = $tenant_id);
SET limit = COALESCE($limit, 50);
SET offset = COALESCE($offset, 0);
SET total_pages = ($total_rows + $limit - 1) / $limit;
SET current_page = ($offset / $limit) + 1; 
      SELECT
          CASE
              WHEN length(q.target_url) > 60 THEN substr(q.target_url, 1, 60) || '...'
              ELSE q.target_url
          END AS "Target URL",
          CASE
              WHEN q.http_status BETWEEN 200 AND 299 THEN '🟢 ' || q.http_status
              WHEN q.http_status BETWEEN 300 AND 399 THEN '🟠 ' || q.http_status
              WHEN q.http_status BETWEEN 400 AND 599 THEN '🔴 ' || q.http_status
              ELSE CAST(q.http_status AS TEXT)
          END AS "HTTP Status",
          q.ip_address AS "IP Address",
          q.country AS "Country",
          q.http_server AS "Web Server",
          q.page_title AS "Detected Technologies",
          q.uncommon_headers AS "Key HTTP Headers"
      FROM (
          SELECT *
          FROM tem_what_web_result
          WHERE tenant_id = $tenant_id
      ) q
  SELECT 'text' AS component,
    (SELECT CASE WHEN CAST($current_page AS INTEGER) > 1 THEN '[Previous](?limit=' || $limit || '&offset=' || ($offset - $limit) || COALESCE('&tenant_id=' || replace($tenant_id, ' ', '%20'), '') || ')' ELSE '' END)
    || ' '
    || '(Page ' || $current_page || ' of ' || $total_pages || ") "
    || (SELECT CASE WHEN CAST($current_page AS INTEGER) < CAST($total_pages AS INTEGER) THEN '[Next](?limit=' || $limit || '&offset=' || ($offset + $limit) || COALESCE('&tenant_id=' || replace($tenant_id, ' ', '%20'), '') || ')' ELSE '' END)
    AS contents_md
;
        ;