# Statistics & Upload Enhancements Plan

## Proposed Changes

### 1. Enhancing [statistics.php](file:///c:/xampp/htdocs/bongofloww/statistics.php) (Pagination, Sort, Search)
- **Search & Filtering:** Add a search bar at the top of the "Recent Transaction History" table to dynamically filter transactions by Video Title, Phone Number, or Status.
- **Sorting:** Add column headers that are clickable, allowing you to sort by Date (newest/oldest) and Amount (highest/lowest).
- **Pagination:** Implement full backend pagination so you can navigate through pages of transactions instead of being strictly locked to the last 10. `LIMIT` and `OFFSET` will be driven by `$_GET['page']`.

### 2. Fixing "Black Screen" Video Thumbnails & Format Support ([upload.php](file:///c:/xampp/htdocs/bongofloww/upload.php))
Currently, thumbnails are auto-generated using JavaScript when you select a file. The black screen happens because the script blindly captures a frame at the 2-second mark (which is often a black fade-in) or the browser fails to render a frame for certain unsupported formats like `.avi` or `.mkv`.

**The Fix:**
- **Smarter Auto-Capture:** Change the auto-capture logic to seek to **30%** into the video (bypassing intros) rather than uniformly at 2 seconds.
- **Custom Thumbnail Fallback (Crucial for all formats):** Since HTML5 simply cannot render or grab frames from raw `.avi`/`.mov`/`.mkv` videos directly in the browser, I will add an optional **Custom Thumbnail Upload** field. If the auto-grab fails or yields a black screen, you can manually select an image to be the thumbnail, completely eliminating the black screen issue.
- **Format Support:** Ensure the PHP backend explicitly accepts `.mov`, `.avi`, `.mkv`, etc., without strict extension blocking.

## User Review Required
> [!IMPORTANT]
> Because browsers only natively play `.mp4`, `.webm`, and `.ogg`, if your users attempt to play raw `.avi` or `.mkv` files on the frontend, the browser video player will fail to play it. Are you handling the conversion of these videos elsewhere, or do you expect the users to download them instead of streaming them? Or would you prefer the upload script to enforce an `.mp4` strict conversion?

If you approve of this plan (Pagination + Smarter Thumbnails + Manual Fallback Option), I will proceed to execution!
