<?php
require_once __DIR__ . '/../../app/core/bootstrap.php';
$pdo = crm_pdo();

// Test 1: EXACT MATCH
$stmt1 = $pdo->query("SELECT count(*) FROM projects WHERE (start_date IS NULL OR start_date = '0000-00-00' OR start_date = '' OR start_date LIKE '0000%')");
$count1 = $stmt1->fetchColumn();

// Test 2: LIKE
$stmt2 = $pdo->query("SELECT count(*) FROM projects WHERE status NOT IN ('completed', 'cancelled') AND (start_date IS NULL OR start_date LIKE '0000%')");
$count2 = $stmt2->fetchColumn();

// Test 3: LENGTH
$stmt3 = $pdo->query("SELECT count(*) FROM projects WHERE status NOT IN ('completed', 'cancelled') AND (start_date IS NULL OR LENGTH(start_date) < 5 OR start_date LIKE '0000%')");
$count3 = $stmt3->fetchColumn();

echo "Count 1: $count1\n";
echo "Count 2: $count2\n";
echo "Count 3: $count3\n";
