mg.onerror = () => {
                            const parent = img.parentElement;
                            const width = parent.offsetWidth || 256;
                            const height = parent.offsetHeight || 256;
                            img.src = createFallbackImageUrl(width, height);
                            img.classList.add('loaded');
                        };
                    });
                }
            }

            function updatePagination() {
                const totalPa