Algebrogeometric solutions of the nonlinear boundary problem on a segment for the sine-Gordon equation