Extracting cavity and pulse phases from limited data for coherent pulse stacking