```ts
/**
 * Removes segments of two dots by dropping them together with the segment standing before it.
 * Two dots with nothing before them are dropped alone.
 *
 * @param path - The input path to clean.
 * @returns The cleaned path.
 */
export function pathClean(path: string): string {
  const segments = path.split('/');
  const result: string[] = [];

  for (let i = 0; i < segments.length; i++) {
    if (segments[i] === '..') {
      if (result.length > 0) {
        result.pop();
      }
    } else if (segments[i] !== '.') {
      result.push(segments[i]);
    }
  }

  return result.join('/');
}
```