<ul>
<li>[CRITICAL] Fixed all $_POST["action"] direct array access without ?? guard in inc/insert_update.php — 16 action branches now use ($_POST["action"] ?? "") preventing PHP8 TypeError on direct/empty POST requests</li>
<li>[HIGH] Fixed extract($getMediaInfoData) without empty guard in deleteMedia action — added null check with fallback vars to prevent Warning: extract() on non-array</li>
<li>[HIGH] Fixed json_decode($roles) without null guard in list_gallery_albums.php (lines 14, 45) and list_gallery_items.php (line 71) — changed to json_decode($var ?? "[]", true) ?? [] preventing PHP8 TypeError in in_array()</li>
<li>[MEDIUM] Fixed hardcoded https://archive.org external URL for no-cover-image fallback in list_gallery_albums.php — replaced with local /website/assets/common/images/noimage.png</li>
<li>[MEDIUM] Fixed bare $_SERVER[REQUEST_URI] (missing quotes) in catch/list_gallery_items.php line 9 — PHP Notice: Use of undefined constant REQUEST_URI</li>
<li>[MEDIUM] Fixed $_GET["siteid"] and $siteid undefined in catch/catch.php lines 364, 423 — added ?? "" null coalescing guard</li>
<li>[MEDIUM] Fixed broken HTML tag nesting in list_gallery_albums.php — h4 was closed before closing a tag (h4.m-0 > a > /h4 > /a) corrected to h4.m-0 > a > /a > /h4</li>
<li>[SPEED] Eliminated N+1 query: gallery cover images (domain_tbl_media_gallery_items_media) now pre-cached before foreach loop in list_gallery_albums.php — was 1 query per gallery card</li>
<li>[SPEED] Eliminated N+1 query: category item counts now pre-cached before category foreach in list_gallery_albums.php and catch/list_gallery_items.php — was 1 query per category</li>
<li>[SPEED] Added composite DB index idx_cover_active (MainCover, ItemActivated) on domain_tbl_media_gallery_items_media — cover pre-cache query changed from type:ALL to type:ref</li>
<li>[SPEED] Added composite DB index idx_gid_activated (MediaGalleryID_fk, Activated) on domain_tbl_media_gallery_items</li>
<li>[SPEED] Added index idx_cat_fk (GalleryCategoryID_fk) on domain_tbl_media_gallery_items for category grouping</li>
<li>CRUD verified: CREATE, READ, UPDATE, DELETE gallery items and categories all functional with 0 console errors and 0 network failures before and after</li>
</ul>