This is from Taylor's classical mechanichs, 11.4, example of finding the Lagrangian of the double pendulum
Relevant figure attached below
Angle between the two velocities of second mass is
$$\phi_2-\phi_1$$
Potential energy
$$U_1=m_1gL_1$$
$$U_2=m_2g[L_1\cos(1-\phi_1)+L_2(1-\phi_2)]$$...