Phase Transitions in the Detection of Correlated Databases